Generic subtask for processing a user-supplied template. The template is specified in the templateFile
configuration parameter. It operates in two modes: per class and single output.
addOfType
protected void addOfType(String ofType)
addPackageSubstitution
public void addPackageSubstitution(PackageTagsHandler.PackageSubstitution ps)
Substitutes the package of the generated files.
ps
- The feature to be added to the Fileset attribute
engineFinished
protected void engineFinished()
throws TemplateException
Describe what the method does
engineStarted
protected void engineStarted()
throws XDocletException
Describe what the method does
generateForClass
protected void generateForClass(XClass clazz)
throws XDocletException
Processed template for clazz and generates output file for clazz.
clazz
- Description of Parameter
getAcceptAbstractClasses
public boolean getAcceptAbstractClasses()
getAcceptInterfaces
public boolean getAcceptInterfaces()
getDestinationFile
public String getDestinationFile()
Gets the DestinationFile attribute of the TemplateSubTask object
- The DestinationFile value
getEngine
public TemplateEngine getEngine()
Gets the Engine attribute of the TemplateSubTask object
getExtent
public String getExtent()
Gets the Extent attribute of the TemplateSubTask object
getGeneratedFileName
protected String getGeneratedFileName(XClass clazz)
throws XDocletException
Returns class name for the generated file. {0} substituted by class name.
clazz
- Description of Parameter
- The GeneratedClassName value
getHavingClassTag
public String getHavingClassTag()
Gets the HavingClassTag attribute of the TemplateSubTask object
getOfType
public String[] getOfType()
Gets the OfType attribute of the TemplateSubTask object
getPackageSubstitutions
public ArrayList getPackageSubstitutions()
Gets the PackageSubstitutions attribute of the TemplateSubTask object
- The PackageSubstitutions value
getSubTaskClassName
public String getSubTaskClassName()
Gets the SubTaskClassName attribute of the TemplateSubTask object
- The SubTaskClassName value
getTemplateURL
public URL getTemplateURL()
Gets the TemplateURL attribute of the TemplateSubTask object
isPackageSubstitutionInheritanceSupported
public boolean isPackageSubstitutionInheritanceSupported()
By default supports, but some subtasks may not support because global packageSubstitution is for public
interfaces/classes, not good for impl classes.
isPrefixWithPackageStructure
public boolean isPrefixWithPackageStructure()
Gets the PrefixWithPackageStructure attribute of the TemplateSubTask object
- The PrefixWithPackageStructure value
javaFile
protected static String javaFile(String className)
Converts the full qualified class name to a valid path with File.separator characters instead of . characters and
class name postfixed by a ".java".
className
- Description of Parameter
- Description of the Returned Value
matchesGenerationRules
protected boolean matchesGenerationRules(XClass clazz)
throws XDocletException
Returns true if output not already generated for clazz, and is of the specified type and has the specified class
tag; false otherwise. If returned false, no output file is generated for clazz.
clazz
- Description of Parameter
- Description of the Returned Value
processInnerClasses
protected boolean processInnerClasses()
Subclasses should override this method and return true if they want startProcessPerClass() to process inner
classes too.
setAcceptAbstractClasses
public void setAcceptAbstractClasses(boolean acceptAbstractClasses)
Indicates whether or not to generate for abstract classes.
setAcceptInterfaces
public void setAcceptInterfaces(boolean acceptInterfaces)
Indicates whether or not to generate for interfaces.
setDestinationFile
public void setDestinationFile(String destinationFile)
The destination file name. If a {0} is found it's assumed that a per class output generation is needed, so {0} is
substituted with class name; otherwise a single file is generated with the specified name.
destinationFile
- The new DestinationFile value
- No,defaultis
determinedbythis
task.
setEngine
public void setEngine(TemplateEngine engine)
Sets the Engine attribute of the TemplateSubTask object
engine
- The new Engine value
setExtent
public void setExtent(TemplateSubTask.ExtentTypes extent)
You can control the extent in which the type search occurs. Valid values are:
- "concrete-type": the class is itself one of the classes listed in ofType attribute.
- "superclass": the class is itself one of the classes listed in ofType attribute or its superclass is one
of the listed ones
- "hierarchy" which is the default: anywhere in its hierarchy it derives from one of the listed classes.
There's no distinction between a class and an interface.
extent
- The new Extent value
setExtentValue
protected void setExtentValue(String extent)
Sets the ExtentValue attribute of the TemplateSubTask object
extent
- The new ExtentValue value
setGenerationManager
protected void setGenerationManager(GenerationManager gM)
Sets the GenerationManager attribute of the TemplateSubTask object
gM
- The new GenerationManager value
setHavingClassTag
public void setHavingClassTag(String havingClassTag)
Sets the HavingClassTag attribute of the TemplateSubTask object
havingClassTag
- The new HavingClassTag value
setOfType
public void setOfType(String ofType)
setPackageSubstitutionInheritanceSupported
public void setPackageSubstitutionInheritanceSupported(boolean packageSubstitutionInheritanceSupported)
Indicates whether or not package substitution should be inherited
packageSubstitutionInheritanceSupported
- The new PackageSubstitutionInheritanceSupported value
setPackageSubstitutions
public void setPackageSubstitutions(ArrayList packageSubstitutions)
Sets the PackageSubstitutions attribute of the TemplateSubTask object
packageSubstitutions
- The new PackageSubstitutions value
setPrefixWithPackageStructure
public void setPrefixWithPackageStructure(boolean prefixWithPackageStructure)
Indicates whether or not to prefix with package structure.
prefixWithPackageStructure
- The new PrefixWithPackageStructure value
setSubTaskClassName
public void setSubTaskClassName(String subTaskClassName)
Sets the SubTaskClassName attribute of the TemplateSubTask object
subTaskClassName
- The new SubTaskClassName value
setTemplateFile
public void setTemplateFile(File templateFile)
throws XDocletException
Sets the name of the template file to use for generation
templateFile
- the file name (real file!) of the template
- No,defaultis
determinedbythis
task.
setTemplateURL
public void setTemplateURL(URL templateURL)
This method should be called to set a template file programmatically. The URL is typically obtained with a
getClass().getResource( templateName )
startEngine
protected final void startEngine(URL templateURL,
File outputFile)
throws TemplateException
Describe what the method does
templateURL
- Describe what the parameter doesoutputFile
- Describe what the parameter does
startProcess
protected void startProcess()
throws XDocletException
Describe what the method does
startProcessPerClass
protected void startProcessPerClass()
throws XDocletException