An Expander is a utility included in the Default Velocity context that you use to explode references. Uses for an Expander are as follows:
- ${project.Version} and ${project.Name}: This variable will replace your Version and Name properties of your current project.
- ${artifact.Name}, ${artifact.Package} and ${artifact.Path}: This variable displays a name, package, and a path-like String for your package (eg com/mycompany/myPackage) of the current Artifact. This variable is only useful for Artifact based rules.
- ${ppProp.propertyName}: This variable displays the value of the Global Property named propertyName in your plug-in.
- ${model.attributeName}: This variable displays the value of the attribute named attributeName in your model. Note: The Model should be replaced with the name of the model set in the rule specification.
© copyright 2005, 2006, 2007 Cisco Systems, Inc. - All rights reservedWhen defining a rule, use the direct syntax. The whole filename string is automatically passed to the default Expander. For example, for an output file the defintion might look like the following:
- ${artifact.Path}/${artifact.Name}.java
Within your template, use $exp.expandVar(expanderVariable), where expanderVariable complies with the syntax above. For example, $exp.expandVar("${ppProp.xmlDirectory}").