Next, Joe notices that by using the #prompt
directive,
he could accept input from the user while the template is being processed.
To test this functionality, he modifies his method template:
#prompt ( "Method Description:" $methodDescription ) #prompt ( "Return Type:" $returnType "void") #prompt ( "Method Name:" $methodName ) #prompt ( "Parameters:" $parameters ) /** * ${methodDescription} */ public ${returnType} ${methodName}(${parameters}) { ${returnType} retVal = null; return retVal; }
Now when this template is processed by the Templates plugin, the user will be prompted for each of:
a method description
the type for the return value (default = "void")
the name of the method
any parameters to be passed to the method
Each of these values is then "filled in" at the appropriate point in the generated code.