Class XMLBean
- All Implemented Interfaces:
Cloneable
,SelectorContainer
public class XMLBean extends MatchingTask
Schema files to process, or directories of schema files, are set with the 'schema' attribute, and can be filtered with 'includes' and 'excludes'. Alternatively, one or more nested <fileset> elements can specify the files and directories to be used to generate this XMLBean. The include set can also define .java files that should be built as well. See the FileSet documentation at http://jakarta.apache.org/ant/manual/index.html for instructions on FileSets if you are unfamiliar with their usage.
-
Nested Class Summary
Nested Classes Modifier and Type Class Description class
XMLBean.ErrorLogger
-
Field Summary
-
Constructor Summary
Constructors Constructor Description XMLBean()
-
Method Summary
Modifier and Type Method Description void
addFileset(FileSet fileset)
Path
createClasspath()
Adds a path to the classpath.Extension
createExtension()
One or more SchemaCompiler extensions can be passed in via the <extension> subelement.void
execute()
String
getCatalog()
Gets the XML Catalog file for org.apache.xml.resolver.tools.CatalogResolver.File
getClassgendir()
Path
getClasspath()
String
getDebugLevel()
Get the value of debugLevel.File
getDestfile()
String
getExecutable()
String
getIgnoreDuplicatesInNamespaces()
String
getMemoryInitialSize()
Set the initial memory size of the underlying javac process.String
getMemoryMaximumSize()
Set the maximum memory size of the underlying javac process.boolean
getOptimize()
Gets the optimize flag.String
getPartialMethods()
String
getRepackage()
File
getSchema()
File
getSrcgendir()
String
getTypesystemname()
boolean
isDebug()
boolean
isDownload()
boolean
isFailonerror()
boolean
isIncludeAntRuntime()
boolean
isIncludeJavaRuntime()
boolean
isNoAnnotations()
boolean
isNoExt()
boolean
isNoPvr()
boolean
isNoSrcRegen()
boolean
isNoUpa()
boolean
isNoValidateDoc()
boolean
isNowarn()
boolean
isQuiet()
boolean
isSrconly()
boolean
isVerbose()
void
setCatalog(String catalog)
Sets the XML Catalog file for org.apache.xml.resolver.tools.CatalogResolver.void
setClassgendir(File classgendir)
Set a location to generate .class files into.void
setClasspath(Path classpath)
The classpath to use if schemas in the fileset import definitions that are supplied by other compiled xml beans JAR files, or if .java files are in the schema fileset.void
setClasspathRef(Reference classpathref)
Adds a reference to a classpath defined elsewhere.void
setCompiler(String compiler)
Choose the implementation for this particular task.void
setDebug(boolean debug)
Generate debugging symbols.void
setDebugLevel(String v)
Keyword list to be appended to the -g command-line switch.void
setDestfile(File destfile)
Define the name of the jar file created.void
setDownload(boolean download)
Set to true to permit the compiler to download URLs for imports and includes.void
setExecutable(String forkExec)
Sets the the name of the javac executable.void
setFailonerror(boolean failonerror)
Determines whether or not the ant target will continue if the XMLBean creation encounters a build error.void
setFork(boolean f)
If true, forks the javac compiler.void
setIgnoreDuplicatesInNamespaces(String namespaces)
One or more namespaces in which duplicate definitions are to be ignored can be passed in via the <ignoreDuplicatesInNamespaces> subelement.void
setIncludeAntRuntime(boolean includeAntRuntime)
void
setIncludeJavaRuntime(boolean includeJavaRuntime)
void
setMemoryInitialSize(String memoryInitialSize)
void
setMemoryMaximumSize(String memoryMaximumSize)
void
setNoAnnotations(boolean noann)
Skip over schema <annotation%gt; elements.void
setNoExt(boolean noext)
Ignore extensions found in .xsdconfig filesvoid
setNoPvr(boolean nopvr)
Do not enforce the particle valid (restriction) rule.void
setNoSrcRegen(boolean noSrcRegen)
void
setNoUpa(boolean noupa)
Do not enforce the unique particle attribution rule.void
setNoValidateDoc(boolean novdoc)
Do not validate the contents of schema <documentation> elements.void
setNowarn(boolean nowarn)
void
setOptimize(boolean optimize)
If true, compiles with optimization enabled.void
setPartialMethods(String partialMethods)
Comma separated list of bean methods to be generated.void
setQuiet(boolean quiet)
Controls the amount of output.void
setRepackage(String repackage)
void
setSchema(File schema)
A file that points to either an individual schema file or a directory of files.void
setSource(String s)
void
setSrcgendir(File srcgendir)
Set a location to generate .java files into.void
setSrconly(boolean srconly)
A value of true means that only source will be generated.void
setTypesystemname(String typesystemname)
The name of the package that the TypeSystemHolder class should be generated in.void
setVerbose(boolean verbose)
Controls the amount of output.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, XsetItems
Methods 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, setTaskType
Methods inherited from class org.apache.tools.ant.ProjectComponent
clone, getDescription, getLocation, getProject, setDescription, setLocation
-
Constructor Details
-
XMLBean
public XMLBean()
-
-
Method Details
-
execute
- Overrides:
execute
in classTask
- Throws:
BuildException
-
addFileset
-
getSchema
-
setSchema
A file that points to either an individual schema file or a directory of files. It is optional only if one or more <fileset> elements are nested in this task.- Parameters:
schema
- Required, unless a fileset element is nested.
-
setClasspath
The classpath to use if schemas in the fileset import definitions that are supplied by other compiled xml beans JAR files, or if .java files are in the schema fileset.- Parameters:
classpath
- Optional.
-
createClasspath
Adds a path to the classpath. -
setClasspathRef
Adds a reference to a classpath defined elsewhere.- Parameters:
classpathref
- Optional.
-
getClasspath
-
getDestfile
-
setDestfile
Define the name of the jar file created. For instance, "myXMLBean.jar" will output the results of this task into a jar with the same name. Optional, defaults to "xmltypes.jar".- Parameters:
destfile
- Optional.
-
getSrcgendir
-
setSrcgendir
Set a location to generate .java files into. Optional, defaults to a temp dir.- Parameters:
srcgendir
- Optional.
-
getClassgendir
-
setClassgendir
Set a location to generate .class files into. Optional, defaults to a temp dir.- Parameters:
classgendir
- Optional.
-
setCompiler
Choose the implementation for this particular task.- Since:
- Ant 1.5
-
isDownload
public boolean isDownload() -
setDownload
public void setDownload(boolean download)Set to true to permit the compiler to download URLs for imports and includes. Defaults to false, meaning all imports and includes must be copied locally.- Parameters:
download
- Optional.
-
setOptimize
public void setOptimize(boolean optimize)If true, compiles with optimization enabled. -
getOptimize
public boolean getOptimize()Gets the optimize flag. -
isVerbose
public boolean isVerbose() -
setVerbose
public void setVerbose(boolean verbose)Controls the amount of output. Defaults to true.- Parameters:
verbose
- Optional.
-
isQuiet
public boolean isQuiet() -
setQuiet
public void setQuiet(boolean quiet)Controls the amount of output. Defaults to false.- Parameters:
quiet
- Optional.
-
isDebug
public boolean isDebug() -
getDebugLevel
Get the value of debugLevel.- Returns:
- value of debugLevel.
-
setDebugLevel
Keyword list to be appended to the -g command-line switch.This will be ignored by all implementations except modern and classic(ver >= 1.2). Legal values are none or a comma-separated list of the following keywords: lines, vars, and source. If debuglevel is not specified, by default, :none will be appended to -g. If debug is not turned on, this attribute will be ignored.
- Parameters:
v
- Value to assign to debugLevel.
-
setDebug
public void setDebug(boolean debug)Generate debugging symbols.- Parameters:
debug
- Optional.
-
setFork
public void setFork(boolean f)If true, forks the javac compiler.- Parameters:
f
- "true|false|on|off|yes|no"
-
setExecutable
Sets the the name of the javac executable.Ignored unless fork is true or extJavac has been specified as the compiler.
-
getExecutable
-
isSrconly
public boolean isSrconly() -
setSrconly
public void setSrconly(boolean srconly)A value of true means that only source will be generated. Optional, default is false.- Parameters:
srconly
- Optional.
-
getTypesystemname
-
createExtension
One or more SchemaCompiler extensions can be passed in via the <extension> subelement. Schema Compiler extensions must implement the interface org.apache.xmlbeans.impl.tool.SchemaCompilerExtension -
setIgnoreDuplicatesInNamespaces
One or more namespaces in which duplicate definitions are to be ignored can be passed in via the <ignoreDuplicatesInNamespaces> subelement. -
getIgnoreDuplicatesInNamespaces
-
setTypesystemname
The name of the package that the TypeSystemHolder class should be generated in. Normally this should be left unspecified. None of the xml beans are generated in this package.
Use .xsdconfig files to modify xml bean package or class names.- Parameters:
typesystemname
- Optional.
-
isFailonerror
public boolean isFailonerror() -
setFailonerror
public void setFailonerror(boolean failonerror)Determines whether or not the ant target will continue if the XMLBean creation encounters a build error. Defaults to true. Optional.- Parameters:
failonerror
- Optional.
-
isIncludeAntRuntime
public boolean isIncludeAntRuntime() -
setIncludeAntRuntime
public void setIncludeAntRuntime(boolean includeAntRuntime) -
isIncludeJavaRuntime
public boolean isIncludeJavaRuntime() -
setIncludeJavaRuntime
public void setIncludeJavaRuntime(boolean includeJavaRuntime) -
isNowarn
public boolean isNowarn() -
setNowarn
public void setNowarn(boolean nowarn) -
isNoSrcRegen
public boolean isNoSrcRegen() -
setNoSrcRegen
public void setNoSrcRegen(boolean noSrcRegen) -
getMemoryInitialSize
Set the initial memory size of the underlying javac process. -
setMemoryInitialSize
-
getMemoryMaximumSize
Set the maximum memory size of the underlying javac process. -
setMemoryMaximumSize
-
setNoUpa
public void setNoUpa(boolean noupa)Do not enforce the unique particle attribution rule. -
isNoUpa
public boolean isNoUpa() -
setNoPvr
public void setNoPvr(boolean nopvr)Do not enforce the particle valid (restriction) rule. -
isNoPvr
public boolean isNoPvr() -
setNoAnnotations
public void setNoAnnotations(boolean noann)Skip over schema <annotation%gt; elements. -
isNoAnnotations
public boolean isNoAnnotations() -
setNoValidateDoc
public void setNoValidateDoc(boolean novdoc)Do not validate the contents of schema <documentation> elements. -
isNoValidateDoc
public boolean isNoValidateDoc() -
setNoExt
public void setNoExt(boolean noext)Ignore extensions found in .xsdconfig files- Parameters:
noext
- Ignore extensions
-
isNoExt
public boolean isNoExt() -
setSource
-
getCatalog
Gets the XML Catalog file for org.apache.xml.resolver.tools.CatalogResolver. (Note: needs resolver.jar from http://xml.apache.org/commons/components/resolver/index.html) -
setCatalog
Sets the XML Catalog file for org.apache.xml.resolver.tools.CatalogResolver. (Note: needs resolver.jar from http://xml.apache.org/commons/components/resolver/index.html) -
getRepackage
-
setRepackage
-
getPartialMethods
-
setPartialMethods
Comma separated list of bean methods to be generated. Use "-" to negate and "ALL" for all. processed left-to-right, e.g. "ALL,-GET_LIST" exclude java.util.List getters- See Also:
XmlOptions.BeanMethod
-