xdoclet
Class TemplateSubTask

java.lang.Object
  |
  +--xdoclet.DocletSupport
        |
        +--xdoclet.SubTask
              |
              +--xdoclet.TemplateSubTask
All Implemented Interfaces:
java.io.Serializable
Direct Known Subclasses:
XmlSubTask

public class TemplateSubTask
extends SubTask

Generates The template file specified in templateFile configuration parameter. It operates in two modes: per class and single output.

Version:
$Revision: 1.70 $
Author:
Ara Abrahamian (ara_e@email.com)
See Also:
Serialized Form
ant.element
name="template" parent="xdoclet.DocletTask" display-name="Standard Subtask"
ant.attribute
name="destinationFile" description="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." required="Yes", name="extent" description="You can control the extent in which the type search occurs. Valid values are: concrete-type , superclass and hierarchy ." required="No. Default is \"hierarchy\""
created
Sep 25, 2001

Nested Class Summary
static class TemplateSubTask.ExtentTypes
           
static class TemplateSubTask.OfType
          Applicable only to per class output generation.
 
Field Summary
 
Fields inherited from class xdoclet.DocletSupport
currentClassTag, currentFieldTag, currentMethodTag
 
Constructor Summary
TemplateSubTask()
           
 
Method Summary
protected  void addOfType(java.lang.String ofType)
           
 void addOfType(TemplateSubTask.OfType ofType)
           
 void addPackageSubstitution(PackageTagsHandler.PackageSubstitution ps)
          Substitutes the package of the generated files.
 void copyAttributesFrom(TemplateSubTask src)
          Describe what the method does
protected  void engineFinished()
          Describe what the method does
protected  void engineStarted()
          Describe what the method does
 void execute()
          Describe what the method does
protected  void generateForClass(xjavadoc.XClass clazz)
          Processed template for clazz and generates output file for clazz.
 boolean getAcceptAbstractClasses()
           
 boolean getAcceptInterfaces()
           
 java.lang.String getDestinationFile()
          Gets the DestinationFile attribute of the TemplateSubTask object
 TemplateEngine getEngine()
          Gets the Engine attribute of the TemplateSubTask object
 java.lang.String getExtent()
          Gets the Extent attribute of the TemplateSubTask object
protected  java.lang.String getGeneratedFileName(xjavadoc.XClass clazz)
          Returns class name for the generated file. {0} substituted by class name.
 GenerationManager getGenerationManager()
           
 java.lang.String getHavingClassTag()
          Gets the HavingClassTag attribute of the TemplateSubTask object
 java.lang.String[] getOfType()
          Gets the OfType attribute of the TemplateSubTask object
 java.util.ArrayList getPackageSubstitutions()
          Gets the PackageSubstitutions attribute of the TemplateSubTask object
 java.lang.String getSubTaskClassName()
          Gets the SubTaskClassName attribute of the TemplateSubTask object
 java.net.URL getTemplateURL()
          Gets the TemplateURL attribute of the TemplateSubTask object
 void init()
          Describe what the method does
 boolean isPackageSubstitutionInheritanceSupported()
          By default supports, but some subtasks may not support because global packageSubstitution is for public interfaces/classes, not good for impl classes.
 boolean isPrefixWithPackageStructure()
          Gets the PrefixWithPackageStructure attribute of the TemplateSubTask object
protected static java.lang.String javaFile(java.lang.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".
protected  boolean matchesGenerationRules(xjavadoc.XClass clazz)
          Returns true if output not already generated for clazz, and is of the specified type and has the specified class tag; false otherwise.
protected  boolean processInnerClasses()
          Subclasses should override this method and return true if they want startProcessPerClass() to process inner classes too.
 void setAcceptAbstractClasses(boolean acceptAbstractClasses)
          Indicates whether or not to generate for abstract classes.
 void setAcceptInterfaces(boolean acceptInterfaces)
          Indicates whether or not to generate for interfaces.
 void setDestinationFile(java.lang.String destinationFile)
          The destination file name.
 void setEngine(TemplateEngine engine)
          Sets the Engine attribute of the TemplateSubTask object
 void setExtent(TemplateSubTask.ExtentTypes extent)
          You can control the extent in which the type search occurs.
protected  void setExtentValue(java.lang.String extent)
          Sets the ExtentValue attribute of the TemplateSubTask object
protected  void setGenerationManager(GenerationManager gM)
          Sets the GenerationManager attribute of the TemplateSubTask object
 void setHavingClassTag(java.lang.String havingClassTag)
          Sets the HavingClassTag attribute of the TemplateSubTask object
 void setOfType(java.lang.String ofType)
           
 void setPackageSubstitutionInheritanceSupported(boolean packageSubstitutionInheritanceSupported)
          Indicates whether or not package substitution should be inherited
 void setPackageSubstitutions(java.util.ArrayList packageSubstitutions)
          Sets the PackageSubstitutions attribute of the TemplateSubTask object
 void setPrefixWithPackageStructure(boolean prefixWithPackageStructure)
          Indicates whether or not to prefix with package structure.
 void setSubTaskClassName(java.lang.String subTaskClassName)
          Sets a different name for the subtask which will be seen in the log messages.
 void setTemplateFile(java.io.File templateFile)
          Sets the name of the template file to use for generation
 void setTemplateURL(java.net.URL templateURL)
          This method should be called to set a template file programmatically.
protected  void startEngine(java.net.URL templateURL, java.io.File outputFile)
          Describe what the method does
protected  void startProcess()
          Describe what the method does
protected  void startProcessForAll()
           
protected  void startProcessPerClass()
           
 void validateOptions()
          Called to validate configuration parameters.
 
Methods inherited from class xdoclet.SubTask
addConfigParam, getConfigParams, getConfigParamsAsMap, getContext, getDestDir, getMergeDir, getSubTaskName, setDestDir, setMergeDir, setSubTaskName
 
Methods inherited from class xdoclet.DocletSupport
getCurrentClass, getCurrentClassTag, getCurrentConstructor, getCurrentField, getCurrentFieldTag, getCurrentMethod, getCurrentMethodTag, getCurrentPackage, getCurrentTag, isDocletGenerated, popCurrentClass, pushCurrentClass, setCurrentClass, setCurrentClassTag, setCurrentConstructor, setCurrentField, setCurrentFieldTag, setCurrentMethod, setCurrentMethodTag, setCurrentPackage
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TemplateSubTask

public TemplateSubTask()
Method Detail

javaFile

protected static java.lang.String javaFile(java.lang.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".

Parameters:
className - Description of Parameter
Returns:
Description of the Returned Value

getAcceptInterfaces

public boolean getAcceptInterfaces()

getAcceptAbstractClasses

public boolean getAcceptAbstractClasses()

getGenerationManager

public GenerationManager getGenerationManager()

getPackageSubstitutions

public java.util.ArrayList getPackageSubstitutions()
Gets the PackageSubstitutions attribute of the TemplateSubTask object

Returns:
The PackageSubstitutions value

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.

Returns:
true

getSubTaskClassName

public java.lang.String getSubTaskClassName()
Gets the SubTaskClassName attribute of the TemplateSubTask object

Returns:
The SubTaskClassName value

getEngine

public TemplateEngine getEngine()
Gets the Engine attribute of the TemplateSubTask object

Returns:
The Engine value

getTemplateURL

public java.net.URL getTemplateURL()
Gets the TemplateURL attribute of the TemplateSubTask object

Returns:
The TemplateURL value

getDestinationFile

public java.lang.String getDestinationFile()
Gets the DestinationFile attribute of the TemplateSubTask object

Returns:
The DestinationFile value

getOfType

public java.lang.String[] getOfType()
Gets the OfType attribute of the TemplateSubTask object

Returns:
The OfType value

getExtent

public java.lang.String getExtent()
Gets the Extent attribute of the TemplateSubTask object

Returns:
The Extent value

getHavingClassTag

public java.lang.String getHavingClassTag()
Gets the HavingClassTag attribute of the TemplateSubTask object

Returns:
The HavingClassTag value

isPrefixWithPackageStructure

public boolean isPrefixWithPackageStructure()
Gets the PrefixWithPackageStructure attribute of the TemplateSubTask object

Returns:
The PrefixWithPackageStructure value

setAcceptInterfaces

public void setAcceptInterfaces(boolean acceptInterfaces)
Indicates whether or not to generate for interfaces.

Parameters:
acceptInterfaces -
ant.element
No, default is "true"

setAcceptAbstractClasses

public void setAcceptAbstractClasses(boolean acceptAbstractClasses)
Indicates whether or not to generate for abstract classes.

Parameters:
acceptAbstractClasses -
ant.element
No, default is "true"

setPackageSubstitutions

public void setPackageSubstitutions(java.util.ArrayList packageSubstitutions)
Sets the PackageSubstitutions attribute of the TemplateSubTask object

Parameters:
packageSubstitutions - The new PackageSubstitutions value

setPackageSubstitutionInheritanceSupported

public void setPackageSubstitutionInheritanceSupported(boolean packageSubstitutionInheritanceSupported)
Indicates whether or not package substitution should be inherited

Parameters:
packageSubstitutionInheritanceSupported - The new PackageSubstitutionInheritanceSupported value
ant.element
No, default is "true"

setSubTaskClassName

public void setSubTaskClassName(java.lang.String subTaskClassName)
Sets a different name for the subtask which will be seen in the log messages.

Parameters:
subTaskClassName - The new SubTaskClassName value

setPrefixWithPackageStructure

public void setPrefixWithPackageStructure(boolean prefixWithPackageStructure)
Indicates whether or not to prefix with package structure.

Parameters:
prefixWithPackageStructure - The new PrefixWithPackageStructure value
ant.element
No, default is "true"

setEngine

public void setEngine(TemplateEngine engine)
Sets the Engine attribute of the TemplateSubTask object

Parameters:
engine - The new Engine value
ant.element

setDestinationFile

public void setDestinationFile(java.lang.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.

Parameters:
destinationFile - The new DestinationFile value
ant.element

setTemplateURL

public void setTemplateURL(java.net.URL templateURL)
This method should be called to set a template file programmatically. The URL is typically obtained with a getClass().getResource( templateName )

Parameters:
templateURL -
ant.element

setTemplateFile

public void setTemplateFile(java.io.File templateFile)
                     throws XDocletException
Sets the name of the template file to use for generation

Parameters:
templateFile - the file name (real file!) of the template
Throws:
XDocletException
ant.element
Yes if its a nested