Class XMLBean

All Implemented Interfaces:
Cloneable, SelectorContainer

public class XMLBean
extends MatchingTask
Modeled after Ant's javac and zip tasks.

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.

  • Constructor Details

  • Method Details

    • execute

      public void execute() throws BuildException
      Overrides:
      execute in class Task
      Throws:
      BuildException
    • addFileset

      public void addFileset​(FileSet fileset)
    • getSchema

      public File getSchema()
    • setSchema

      public void setSchema​(File schema)
      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

      public 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.
      Parameters:
      classpath - Optional.
    • createClasspath

      public Path createClasspath()
      Adds a path to the classpath.
    • setClasspathRef

      public void setClasspathRef​(Reference classpathref)
      Adds a reference to a classpath defined elsewhere.
      Parameters:
      classpathref - Optional.
    • getClasspath

      public Path getClasspath()
    • getDestfile

      public File getDestfile()
    • setDestfile

      public void setDestfile​(File destfile)
      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

      public File getSrcgendir()
    • setSrcgendir

      public void setSrcgendir​(File srcgendir)
      Set a location to generate .java files into. Optional, defaults to a temp dir.
      Parameters:
      srcgendir - Optional.
    • getClassgendir

      public File getClassgendir()
    • setClassgendir

      public void setClassgendir​(File classgendir)
      Set a location to generate .class files into. Optional, defaults to a temp dir.
      Parameters:
      classgendir - Optional.
    • setCompiler

      public void setCompiler​(String compiler)
      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

      public String getDebugLevel()
      Get the value of debugLevel.
      Returns:
      value of debugLevel.
    • setDebugLevel

      public void setDebugLevel​(String v)
      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

      public void setExecutable​(String forkExec)
      Sets the the name of the javac executable.

      Ignored unless fork is true or extJavac has been specified as the compiler.

    • getExecutable

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

      public String getTypesystemname()
    • createExtension

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

      public void setIgnoreDuplicatesInNamespaces​(String namespaces)
      One or more namespaces in which duplicate definitions are to be ignored can be passed in via the <ignoreDuplicatesInNamespaces> subelement.
    • getIgnoreDuplicatesInNamespaces

      public String getIgnoreDuplicatesInNamespaces()
    • setTypesystemname

      public void setTypesystemname​(String typesystemname)
      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

      public String getMemoryInitialSize()
      Set the initial memory size of the underlying javac process.
    • setMemoryInitialSize

      public void setMemoryInitialSize​(String memoryInitialSize)
    • getMemoryMaximumSize

      public String getMemoryMaximumSize()
      Set the maximum memory size of the underlying javac process.
    • setMemoryMaximumSize

      public void setMemoryMaximumSize​(String memoryMaximumSize)
    • 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

      public void setSource​(String s)
    • getCatalog

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

      public void setCatalog​(String catalog)
      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

      public String getRepackage()
    • setRepackage

      public void setRepackage​(String repackage)
    • getPartialMethods

      public String getPartialMethods()
    • setPartialMethods

      public void setPartialMethods​(String partialMethods)
      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