Print
Property substitution

Property substitution

Sometimes it may be necessary to parametrise tag values. XDoclet provides property substitution for tags  (in well known form: ${property.name}). 2 different implementations are pprovided by xdoclet (but of course you can alway write your own expander implementing interface org.xdoclet.QDoxPropertyExpander)

 org.xdoclet.tools.SystemQDoxPropertyExpander

As you may guess from name, this expander utilizes system properties to perform substitutions  - so just feed them to your favorite build system with -Dproperty=value

Invocation through maven-2 plugin: 

<components>
	<component>
		<classname>org.xdoclet.tools.SystemQDoxPropertyExpander</classname>
	</component>
       .........
</component>














SystemQDoxPropertyExpander is provided to ant task automatically and does not require further configuration

org.xdoclet.tools.PropertiesQDoxPropertyExpander

This expander provides support for expansion through arbitrary property files. You can register more than one of them.  First segment of property name will be treated as id of property file. This expander is also provided for in ant task, and can be configured by means of nested <properties/> element:

 !-- Define xdoclet task -->
 <taskdef
    name="xdoclet" classname="org.xdoclet.ant.XDocletTask"
     classpathref="xdoclet.task.classpath"
 />

 <target name="command.mapping.generate">

  <xdoclet>

   <!-- specifies the file-set that carry xdoclet2 tags-->

   <fileset dir="src/main/java">
     <include name="com/xdoclet2tutorial/command/*.java"/>
   </fileset>
  <properties>
	<id>firstSegmentOfPropertyName</id> 
        <file>nameOfFileContainintProperties</file> 
  </properties>

   <!— invoke the plugin -->
   <component classname="com.xdoclet2tutorial.plugin.command.CommandPlugin"
		   destdir="${gen-src-dir}" filereplace="hello.xml"/>

  </xdoclet>
</target>
Powered by Atlassian Confluence