Package org.castor.anttask
Class CastorCodeGenTask
java.lang.Object
org.apache.tools.ant.ProjectComponent
org.apache.tools.ant.Task
org.apache.tools.ant.taskdefs.MatchingTask
org.castor.anttask.CastorCodeGenTask
- All Implemented Interfaces:
Cloneable,org.apache.tools.ant.types.selectors.SelectorContainer
public final class CastorCodeGenTask
extends org.apache.tools.ant.taskdefs.MatchingTask
An Ant task to call the Castor
Source Generator. It can be passed a file, a directory, a Fileset or all
three.
- Version:
- $Revision: 6543 $ $Date: 2005-03-05 06:42:06 -0700 (Sat, 05 Mar 2005) $
- Author:
- Joel Farquhar, Bruce Snyder, Werner Guttmann
-
Field Summary
Fields inherited from class org.apache.tools.ant.taskdefs.MatchingTask
filesetFields inherited from class org.apache.tools.ant.Task
target, taskName, taskType, wrapperFields inherited from class org.apache.tools.ant.ProjectComponent
description, location, project -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddFileset(org.apache.tools.ant.types.FileSet set) Adds a fileset to process that contains schemas to process.voidexecute()Public execute method -- entry point for the Ant task.voidsetAutomaticConflictStrategy(String automaticConflictStrategy) Sets the name conflict strategy to use.voidsetBindingfile(String bindingfile) Sets the binding file to be used for code generation.voidsetCaseInsensitive(boolean caseInsensitive) Controls whether enumerated type lookup should be performed in a case insensitive manner.voidSets the directory such that all schemas in this directory will have code generated for them.voidSets the individual schema that will have code generated for it.voidsetGenerateImportedSchemas(boolean generateImportedSchemas) Controls whether to generate code for imported schemas as well.voidsetGenerateJdoDescriptors(boolean generateJdoDescriptors) Controls whether to generate JDO-specific class descriptors.voidsetGenerateMapping(boolean generateMapping) Controls whether a mapping file should (additionally) be generated.voidsetJClassPrinterType(String jclassPrinterType) Sets the mode for printingJClassinstances.voidSets the line seperator to use for code generation.voidsetNameConflictStrategy(String nameConflictStrategy) Sets the name conflict strategy to use.voidsetNodesc(boolean b) Sets whether or not class descriptors are generated.voidsetNomarshal(boolean b) Sets whether or not marshaling methods are generated.voidsetPackage(String pack) Sets the package that generated code will belong to.voidsetProperties(String properties) Sets the file to use for castor builder properties.voidsetResourcesDirectory(String destination) Sets the directory into which resources will be generated.voidsetSAX1(boolean sax1) Controls whether to generate SAX-1 compliant code.voidsetSchemaURL(String schemaURL) Sets an URL for one individual schema that will have code generated for it.voidsetTestable(boolean b) Sets whether CTF framework code is generated.voidSets the directory into which code will be generated.voidSets the type factory for code generation.voidsetVerbose(boolean b) Sets whether or not code generation gives extra information about its work.voidsetWarnings(boolean b) Sets whether or not non-fatal warnings should be suppressed.Methods inherited from class org.apache.tools.ant.taskdefs.MatchingTask
add, addAnd, addContains, addContainsRegexp, addCustom, addDate, addDepend, addDepth, addDifferent, addFilename, addMajority, addModified, addNone, addNot, addOr, addPresent, addSelector, addSize, addType, appendSelector, createExclude, createExcludesFile, createInclude, createIncludesFile, createPatternSet, getDirectoryScanner, getImplicitFileSet, getSelectors, hasSelectors, selectorCount, selectorElements, setCaseSensitive, setDefaultexcludes, setExcludes, setExcludesfile, setFollowSymlinks, setIncludes, setIncludesfile, setProject, XsetIgnore, XsetItemsMethods inherited from class org.apache.tools.ant.Task
bindToOwner, getOwningTarget, getRuntimeConfigurableWrapper, getTaskName, getTaskType, getWrapper, handleErrorFlush, handleErrorOutput, handleFlush, handleInput, handleOutput, init, isInvalid, log, log, log, log, maybeConfigure, perform, reconfigure, setOwningTarget, setRuntimeConfigurableWrapper, setTaskName, setTaskTypeMethods inherited from class org.apache.tools.ant.ProjectComponent
clone, getDescription, getLocation, getProject, setDescription, setLocation
-
Constructor Details
-
CastorCodeGenTask
public CastorCodeGenTask()No-arg constructor.
-
-
Method Details
-
setFile
Sets the individual schema that will have code generated for it.- Parameters:
file- One schema file.
-
setSchemaURL
Sets an URL for one individual schema that will have code generated for it.- Parameters:
schemaURL- URL for one schema file.
-
setDir
Sets the directory such that all schemas in this directory will have code generated for them.- Parameters:
dir- The directory containing schemas to process.
-
addFileset
public void addFileset(org.apache.tools.ant.types.FileSet set) Adds a fileset to process that contains schemas to process.- Parameters:
set- An individual file set containing schemas.
-
setPackage
Sets the package that generated code will belong to.- Parameters:
pack- The package that generated code will belong to.
-
setTodir
Sets the directory into which code will be generated.- Parameters:
dest- The directory into which code will be generated.
-
setResourcesDirectory
Sets the directory into which resources will be generated. If not specified, resources will be generated in the same location as code.- Parameters:
dest- The directory into which resources will be generated.
-
setBindingfile
Sets the binding file to be used for code generation.- Parameters:
bindingfile- The binding file to be used for code generation.
-
setLineseparator
Sets the line seperator to use for code generation.- Parameters:
ls- The line seperator to use for code generation.
-
setTypes
Sets the type factory for code generation.- Parameters:
tf- The type factory to use for code generation.
-
setVerbose
public void setVerbose(boolean b) Sets whether or not code generation gives extra information about its work.- Parameters:
b- If true, the code generator will be verbose.
-
setNameConflictStrategy
Sets the name conflict strategy to use.- Parameters:
nameConflictStrategy- The name conflict strategy to use
-
setAutomaticConflictStrategy
Sets the name conflict strategy to use.- Parameters:
automaticConflictStrategy- The automatic class name conflict strategy to use
-
setWarnings
public void setWarnings(boolean b) Sets whether or not non-fatal warnings should be suppressed.- Parameters:
b- If true, non-fatal warnings will be suppressed. This additionally means that existing source files will be silently overwritten.
-
setNodesc
public void setNodesc(boolean b) Sets whether or not class descriptors are generated.- Parameters:
b- If true, class descriptors are generated.
-
setNomarshal
public void setNomarshal(boolean b) Sets whether or not marshaling methods are generated.- Parameters:
b- If true, marshaling methods are generated.
-
setTestable
public void setTestable(boolean b) Sets whether CTF framework code is generated.- Parameters:
b- If true, the generated code will be instrumented for the CTF.
-
setGenerateImportedSchemas
public void setGenerateImportedSchemas(boolean generateImportedSchemas) Controls whether to generate code for imported schemas as well.- Parameters:
generateImportedSchemas- True if code should be generated for imported schemas.
-
setGenerateJdoDescriptors
public void setGenerateJdoDescriptors(boolean generateJdoDescriptors) Controls whether to generate JDO-specific class descriptors.- Parameters:
generateJdoDescriptors- True if JDP class descriptors should be generated
-
setSAX1
public void setSAX1(boolean sax1) Controls whether to generate SAX-1 compliant code.- Parameters:
sax1- True if SAX-1 compliant code should be generated.
-
setCaseInsensitive
public void setCaseInsensitive(boolean caseInsensitive) Controls whether enumerated type lookup should be performed in a case insensitive manner.- Parameters:
caseInsensitive- True if enumerated type lookup should be performed in a case insensitive manner
-
setProperties
Sets the file to use for castor builder properties.- Parameters:
properties- The properties to use.
-
setJClassPrinterType
Sets the mode for printingJClassinstances.- Parameters:
jclassPrinterType- The mode for printingJClassinstances.
-
setGenerateMapping
public void setGenerateMapping(boolean generateMapping) Controls whether a mapping file should (additionally) be generated.- Parameters:
generateMapping- True if a mapping file should be generated.
-
execute
public void execute()Public execute method -- entry point for the Ant task. Loops over all schema that need code generated and creates needed code generators, then executes them. If anything goes wrong during execution of the Ant task a BuildException will be thrown.- Overrides:
executein classorg.apache.tools.ant.Task- See Also:
-