The parameters entered by the user can be accessed like all other properties in Velocity by adding the prefix
'data'. For example if you defined a parameter with name 'className' in the template dialog
the parameter can be referenced in your templates with '${data.className}.
The static parameters can be accessed by the Velocity template using the same name under which they are defined i.e. if you define a parameter 'vendor' in the configuration dialog
you can use this parameter in the template with the string '${vendor}'.
The plugin provides a number of hardcoded parameters for the use in the templates.
Velocity String | Description |
${Dates.day} | Current day (1..31) |
${Dates.month} | Current month (January=1, February=2,...) |
${Dates.today} | Current date in the current locale default format |
${Dates.year} | Current year (2006) |
${Selection.directory} | The directory of the selected item. |
${Selection.file} | The file name of the selected item. |
${Selection.module} | The module name of the selected item. |
${Selection.moduleDirectory} | The path containing the module file of the selected item. |
${Selection.package} | The package of the selected item. |
${Selection.project} | The name of the project. |
${Selection.projectDirectory} | The path containing the project file. |
${Selection.rootDirectory} | The root source path containing the selected item. |
The plugin provides a number of hardcoded utility methods for the use in the templates.
Velocity String | Description |
${Dates.date(pattern)} | Returns the current date formatted with the given pattern.
pattern | : | The formatting pattern like supported by java.text.SimpleDateFormat. |
|
${Env.get(variable)} | Returns the given environment variable.
variable | : | The name of the environment variable. |
|
${Strings.capitalize(text)} | Change the first letter into upper case.
text | : | The string to be modified. |
|
${Strings.decapitalize(text)} | Change the first letter into lower case.
text | : | The string to be modified. |
|
${Strings.fillLeft(baseString, string, length)} | Prepends the given string to the given baseString until it has at least the given length.
baseString | : | The starting string. |
string | : | The string which is prepended to be baseString. |
length | : | The length of the returned string. |
|
${Strings.fillRight(baseString, string, length)} | Appends the given string to the given baseString until it has at least the given length.
baseString | : | The starting string. |
string | : | The string which is appended to the baseString. |
length | : | The length of the returned string. |
|
${Strings.formatJavaIdentifier(text)} | Formats the given value as a displayable string. 'aJavaProperty' will be changed to 'A Java Property'.
text | : | The string to be modified. |
|
${System.get(property)} | Returns the given system property.
property | : | The name of the property. |
|