org.andromda.core.cartridge.template
Class Template

java.lang.Object
  extended by org.andromda.core.cartridge.Resource
      extended by org.andromda.core.cartridge.template.Template

public class Template
extends Resource

This class implements the <template> tag in a cartridge descriptor file.

Author:
Matthias Bohlen , Anthony Mowers, Chad Brandon

Constructor Summary
Template()
          The default constructor used by the XmlObjectFactory to instantiate the template configuration.
 
Method Summary
 java.io.File getOutputLocation(java.lang.String metafacadeName, java.lang.String packageName, java.io.File directory, java.lang.String outputPattern)
          Returns the fully qualified output file, this means: the output pattern has been translated the output dir name has been prepended
 ModelElements getSupportedModeElements()
          Tells us the model elements that are supported by this template (i.e.
 boolean isGenerateEmptyFiles()
          Tells us whether output files are generated by this template if the template produces empty output.
 boolean isOutputOnEmptyElements()
          Indicates that when there are no elements in the collection of elements (when isOutputToSingleFile() is true, whether or not the file should be output.
 boolean isOutputToSingleFile()
          If output to single file is true then all model elements found by the processor (i.e.
 void setGenerateEmptyFiles(boolean generateEmptyFiles)
          Tells us whether output files should be generated if this template does not produce any output.
 void setOutputOnEmptyElements(boolean outputOnEmptyElements)
          Sets whether or not we should output a file when no elements exist in the collection of elements when isOutputToSingleFile() returns true.
 void setOutputToSingleFile(boolean outputToSingleFile)
          Sets whether or not we should aggregate elements and output to a single file.
 void setSupportedModelElements(ModelElements supportedModelElements)
          Sets the model elements that are suported by this template.
 java.lang.String toString()
           
 
Methods inherited from class org.andromda.core.cartridge.Resource
getCartridge, getOutlet, getOutputCondition, getOutputLocation, getOutputPattern, getPath, isLastModifiedCheck, isOverwrite, setCartridge, setLastModifiedCheck, setOutlet, setOutputCondition, setOutputPattern, setOverwrite, setPath
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Template

public Template()
The default constructor used by the XmlObjectFactory to instantiate the template configuration.

Method Detail

setGenerateEmptyFiles

public void setGenerateEmptyFiles(boolean generateEmptyFiles)
Tells us whether output files should be generated if this template does not produce any output.

Parameters:
generateEmptyFiles - generate files for empty output yes/no

isGenerateEmptyFiles

public boolean isGenerateEmptyFiles()
Tells us whether output files are generated by this template if the template produces empty output.

Returns:
boolean

getOutputLocation

public java.io.File getOutputLocation(java.lang.String metafacadeName,
                                      java.lang.String packageName,
                                      java.io.File directory,
                                      java.lang.String outputPattern)
Returns the fully qualified output file, this means:

Parameters:
metafacadeName - name of the metafacade.
packageName - name of the package from the model in which the class is contained
directory - the directory as a File.
outputPattern - if defined, this overrides the value of Resource.getOutputPattern().
Returns:
File absolute directory.

getSupportedModeElements

public ModelElements getSupportedModeElements()
Tells us the model elements that are supported by this template (i.e. will be processed by this template)

Returns:
ModelElements all the model elements that should be processed by thsi template
See Also:
ModelElements

setSupportedModelElements

public void setSupportedModelElements(ModelElements supportedModelElements)
Sets the model elements that are suported by this template.

Parameters:
supportedModelElements - the ModelElements instance.
See Also:
ModelElements

isOutputToSingleFile

public boolean isOutputToSingleFile()
If output to single file is true then all model elements found by the processor (i.e. all those having matching modelElements) will aggregated and output to one single file.

Returns:
Returns the outputToSingleFile.

setOutputToSingleFile

public void setOutputToSingleFile(boolean outputToSingleFile)
Sets whether or not we should aggregate elements and output to a single file.

Parameters:
outputToSingleFile - The outputToSingleFile to set.

isOutputOnEmptyElements

public boolean isOutputOnEmptyElements()
Indicates that when there are no elements in the collection of elements (when isOutputToSingleFile() is true, whether or not the file should be output. Default is true

Returns:
true/false
See Also:
isOutputToSingleFile()

setOutputOnEmptyElements

public void setOutputOnEmptyElements(boolean outputOnEmptyElements)
Sets whether or not we should output a file when no elements exist in the collection of elements when isOutputToSingleFile() returns true.

Parameters:
outputOnEmptyElements - the boolean flag.
See Also:
isOutputOnEmptyElements(), isOutputToSingleFile()

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object
See Also:
Object.toString()


Copyright © 2003-2008 AndroMDA.org. All Rights Reserved.