TemplateSubTask (XDoclet 1.2.3 API)
Keywords: xdoclet.TemplateSubTask class

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## xdoclet
Class TemplateSubTask

    java.lang.Object
      xdoclet.DocletSupport
          xdoclet.SubTask
              xdoclet.TemplateSubTask

All Implemented Interfaces:
  Serializable

Direct Known Subclasses:
  AbstractEjbCodeGeneratorSubTask, ActionFormSubTask, AntdocSubTask, BeanInfoSubTask, ComponentSpecificationSubTask, DocumentTagsSubTask, ExternalizerSubTask, FactoryClassSubTask, InfoSubTask, MBeanInterfaceSubTask, MLetSubTask, MockObjectSubTask, Mx4jDescriptionAdapterSubTask, OpenEJBSubTask, PageSpecificationSubTask, PropertiesTranslatorSubTask, ServiceEndpointSubTask, WebWorkActionDocsSubTask, WebWorkConfigPropertiesSubTask, XmlSubTask

public class TemplateSubTask
extends SubTask

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.

Version:
  $Revision: 1.79 $
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(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()`
`String` | `getDestinationFile()` Gets the DestinationFile attribute of the TemplateSubTask object
`TemplateEngine` | `getEngine()` Gets the Engine attribute of the TemplateSubTask object
`String` | `getExtent()` Gets the Extent attribute of the TemplateSubTask object
`protected String` | `getGeneratedFileName(xjavadoc.XClass clazz)` Returns the filename of the generated file for a class.
`GenerationManager` | `getGenerationManager()`
`String` | `getHavingClassTag()` Gets the HavingClassTag attribute of the TemplateSubTask object
`String[]` | `getOfType()` Gets the OfType attribute of the TemplateSubTask object
`ArrayList` | `getPackageSubstitutions()` Gets the PackageSubstitutions attribute of the TemplateSubTask object
`String` | `getSubTaskClassName()` Gets the SubTaskClassName attribute of the TemplateSubTask object
`URL` | `getTemplateURL()` Gets the TemplateURL attribute of the TemplateSubTask object
`void` | `init(xjavadoc.XJavaDoc xJavaDoc)` 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 String` | `javaFile(String className)` Converts the fully 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(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(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(String havingClassTag)` Sets the HavingClassTag attribute of the TemplateSubTask object
`void` | `setOfType(String ofType)`
`void` | `setPackageSubstitutionInheritanceSupported(boolean packageSubstitutionInheritanceSupported)` Indicates whether or not package substitution should be inherited
`void` | `setPackageSubstitutions(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(String subTaskClassName)` Sets the SubTaskClassName attribute of the TemplateSubTask object
`void` | `setTemplateFile(File templateFile)` Sets the name of the template file to use for generation
`void` | `setTemplateURL(URL templateURL)` This method should be called to set a template file programmatically.
`protected void` | `startEngine(URL templateURL, 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, getXJavaDoc, 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 String javaFile(String className)

  Converts the fully qualified class name to a valid path with File.separator characters instead of "." characters and class name postfixed by a ".java".

  Parameters:
    `className` - class name
  Returns:
    file path

### getAcceptInterfaces

    public boolean getAcceptInterfaces()

### getAcceptAbstractClasses

    public boolean getAcceptAbstractClasses()

### getGenerationManager

    public GenerationManager getGenerationManager()

### getPackageSubstitutions

    public 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 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 URL getTemplateURL()

  Gets the TemplateURL attribute of the TemplateSubTask object

  Returns:
    The TemplateURL value

### getDestinationFile

    public String getDestinationFile()

  Gets the DestinationFile attribute of the TemplateSubTask object

  Returns:
    The DestinationFile value

### getOfType

    public String[] getOfType()

  Gets the OfType attribute of the TemplateSubTask object

  Returns:
    The OfType value

### getExtent

    public String getExtent()

  Gets the Extent attribute of the TemplateSubTask object

  Returns:
    The Extent value

### getHavingClassTag

    public 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` -

### setAcceptAbstractClasses

    public void setAcceptAbstractClasses(boolean acceptAbstractClasses)

  Indicates whether or not to generate for abstract classes.

  Parameters:
    `acceptAbstractClasses` -

### setPackageSubstitutions

    public void setPackageSubstitutions(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

### setSubTaskClassName

    public void setSubTaskClassName(String subTaskClassName)

  Sets the SubTaskClassName attribute of the TemplateSubTask object

  Parameters:
    `subTaskClassName` - The new SubTaskClassName value
  ant.element

### setPrefixWithPackageStructure

    public void setPrefixWithPackageStructure(boolean prefixWithPackageStructure)

  Indicates whether or not to prefix with package structure.

  Parameters:
    `prefixWithPackageStructure` - The new PrefixWithPackageStructure value

### 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(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

### 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 )

  Parameters:
    `templateURL` -
  ant.element

### setTemplateFile

    public void setTemplateFile(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`

### 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.

  Parameters:
    `extent` - The new Extent value
  ant.element

### setHavingClassTag

    public void setHavingClassTag(String havingClassTag)

  Sets the HavingClassTag attribute of the TemplateSubTask object

  Parameters:
    `havingClassTag` - The new HavingClassTag value

### setOfType

    public void setOfType(String ofType)

### addOfType

    public void addOfType(TemplateSubTask.OfType ofType)

### addPackageSubstitution

    public void addPackageSubstitution(PackageTagsHandler.PackageSubstitution ps)

  Substitutes the package of the generated files.

  Parameters:
    `ps` - The feature to be added to the Fileset attribute

### copyAttributesFrom

    public void copyAttributesFrom(TemplateSubTask src)

  Describe what the method does

  Overrides:
    `copyAttributesFrom` in class `SubTask`
  Parameters:
    `src` - Describe what the parameter does

### init

    public void init(xjavadoc.XJavaDoc xJavaDoc)
              throws XDocletException

  Describe what the method does

  Overrides:
    `init` in class `SubTask`
  Parameters:
    `xJavaDoc` -
  Throws:
    `XDocletException` - Describe the exception
  See Also:
    `SubTask.execute()`

### validateOptions

    public void validateOptions()
                         throws XDocletException

  Called to validate configuration parameters.

  Overrides:
    `validateOptions` in class `SubTask`
  Throws:
    `XDocletException` - Description of Exception

### execute

    public void execute()
                 throws XDocletException

  Describe what the method does

  Specified by:
    `execute` in class `SubTask`
  Throws:
    `XDocletException` - Describe the exception

### getGeneratedFileName

    protected String getGeneratedFileName(xjavadoc.XClass clazz)
                                   throws XDocletException

  Returns the filename of the generated file for a class. If the string "{0}" is present in the pattern, it will be substituted with the transformed class name.

  Parameters:
    `clazz` - the class being processed
  Returns:
    the corresponding filename
  Throws:
    `XDocletException` - Description of Exception

### setGenerationManager

    protected void setGenerationManager(GenerationManager gM)

  Sets the GenerationManager attribute of the TemplateSubTask object

  Parameters:
    `gM` - The new GenerationManager value

### setExtentValue

    protected void setExtentValue(String extent)

  Sets the ExtentValue attribute of the TemplateSubTask object

  Parameters:
    `extent` - The new ExtentValue value

### startEngine

    protected final void startEngine(URL templateURL,
                                     File outputFile)
                              throws TemplateException

  Describe what the method does

  Parameters:
    `templateURL` - Describe what the parameter does
    `outputFile` - Describe what the parameter does
  Throws:
    `TemplateException` - Describe the exception

### addOfType

    protected void addOfType(String ofType)

### startProcess

    protected void startProcess()
                         throws XDocletException

  Describe what the method does

  Throws:
    `XDocletException` - Describe the exception

### startProcessForAll

    protected void startProcessForAll()
                               throws XDocletException

  Throws:
    `XDocletException`

### processInnerClasses

    protected boolean processInnerClasses()

  Subclasses should override this method and return true if they want startProcessPerClass() to process inner classes too.

  Returns:

### startProcessPerClass

    protected void startProcessPerClass()
                                 throws XDocletException

  Throws:
    `XDocletException`

### matchesGenerationRules

    protected boolean matchesGenerationRules(xjavadoc.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.

  Parameters:
    `clazz` - Description of Parameter
  Returns:
    Description of the Returned Value
  Throws:
    `XDocletException` - Description of Exception

### generateForClass

    protected void generateForClass(xjavadoc.XClass clazz)
                             throws XDocletException

  Processed template for clazz and generates output file for clazz.

  Parameters:
    `clazz` - Description of Parameter
  Throws:
    `XDocletException` - Description of Exception

### engineStarted

    protected void engineStarted()
                          throws XDocletException

  Describe what the method does

  Throws:
    `XDocletException` - Describe the exception

### engineFinished

    protected void engineFinished()
                           throws TemplateException

  Describe what the method does

  Throws:
    `TemplateException` - Describe the exception

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| http://xdoclet.sourceforge.net/
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD