Class Options


  • public class Options
    extends Object
    Global options.

    This class stores invocation configuration for XJC. The configuration in this class should be abstract enough so that it could be parsed from both command-line or Ant.

    • Field Detail

      • debugMode

        public boolean debugMode
        If "-debug" is specified.
      • verbose

        public boolean verbose
        If the "-verbose" option is specified.
      • quiet

        public boolean quiet
        If the "-quiet" option is specified.
      • readOnly

        public boolean readOnly
        If the -readOnly option is specified.
      • noFileHeader

        public boolean noFileHeader
        No file header comment (to be more friendly with diff.)
      • enableIntrospection

        public boolean enableIntrospection
        When on, fixes getter/setter generation to match the Bean Introspection API
      • contentForWildcard

        public boolean contentForWildcard
        When on, generates content property for types with multiple xs:any derived elements (which is supposed to be correct behaviour)
      • encoding

        public String encoding
        Encoding to be used by generated java sources, null for platform default.
      • disableXmlSecurity

        public boolean disableXmlSecurity
        If true XML security features when parsing XML documents will be disabled. The default value is false.

        Boolean

        Since:
        2.2.6
      • strictCheck

        public boolean strictCheck
        Check the source schemas with extra scrutiny. The exact meaning depends on the schema language.
      • runtime14

        public boolean runtime14
        If -explicit-annotation option is specified.

        This generates code that works around issues specific to 1.4 runtime.

      • automaticNameConflictResolution

        public boolean automaticNameConflictResolution
        If true, try to resolve name conflicts automatically by assigning mechanical numbers.
      • STRICT

        public static final int STRICT
        strictly follow the compatibility rules and reject schemas that contain features from App. E.2, use vendor binding extensions
        See Also:
        Constant Field Values
      • EXTENSION

        public static final int EXTENSION
        loosely follow the compatibility rules and allow the use of vendor binding extensions
        See Also:
        Constant Field Values
      • compatibilityMode

        public int compatibilityMode
        this switch determines how carefully the compiler will follow the compatibility rules in the spec. Either STRICT or EXTENSION.
      • target

        public SpecVersion target
        Generates output for the specified version of the runtime.
      • targetDir

        public File targetDir
        Target directory when producing files.

        This field is not used when XJC is driven through the XJC API. Plugins that need to generate extra files should do so by using JPackage.addResourceFile(JResourceFile).

      • entityResolver

        public EntityResolver entityResolver
        On JDK 8 an odler stores CatalogResolver, but the field type is made to EntityResolver so that XJC can be used even if resolver.jar is not available in the classpath.
      • defaultPackage

        public String defaultPackage
        The -p option that should control the default Java package that will contain the generated code. Null if unspecified.
      • defaultPackage2

        public String defaultPackage2
        Similar to the -p option, but this one works with a lower priority, and customizations overrides this. Used by JAX-RPC.
      • proxyAuth

        public String proxyAuth
      • activePlugins

        public final List<Plugin> activePlugins
        Plugins that are enabled in this compilation.
      • pluginURIs

        public final Set<String> pluginURIs
        Set of URIs that plug-ins recognize as extension bindings.
      • classNameAllocator

        public ClassNameAllocator classNameAllocator
        This allocator has the final say on deciding the class name.
      • packageLevelAnnotations

        public boolean packageLevelAnnotations
        This switch controls whether or not xjc will generate package level annotations
      • classpaths

        public final List<URL> classpaths
    • Constructor Detail

      • Options

        public Options()
    • Method Detail

      • isExtensionMode

        public boolean isExtensionMode()
      • getNameConverter

        public NameConverter getNameConverter()
        Gets the active NameConverter that shall be used to build Model.
        Returns:
        can be null, in which case it's up to the binding.
      • getAllPlugins

        public List<Plugin> getAllPlugins()
        Gets all the Plugins discovered so far.

        A plugins are enumerated when this method is called for the first time, by taking classpaths into account. That means "-cp plugin.jar" has to come before you specify options to enable it.

      • getSchemaLanguage

        public Language getSchemaLanguage()
      • setSchemaLanguage

        public void setSchemaLanguage​(Language _schemaLanguage)
      • getGrammars

        public InputSource[] getGrammars()
        Input schema files.
      • addGrammar

        public void addGrammar​(InputSource is)
        Adds a new input schema.
      • addGrammar

        public void addGrammar​(File source)
      • addGrammarRecursive

        public void addGrammarRecursive​(File dir)
        Recursively scan directories and add all XSD files in it.
      • getBindFiles

        public InputSource[] getBindFiles()
        Input external binding files.
      • addBindFile

        public void addBindFile​(InputSource is)
        Adds a new binding file.
      • addBindFile

        public void addBindFile​(File bindFile)
        Adds a new binding file.
      • addBindFileRecursive

        public void addBindFileRecursive​(File dir)
        Recursively scan directories and add all ".xjb" files in it.
      • getUserClassLoader

        public ClassLoader getUserClassLoader​(ClassLoader parent)
        Gets a classLoader that can load classes specified via the -classpath option.
      • getModuleName

        public String getModuleName()
        Gets Java module name option.
        Returns:
        Java module name option or null if this option was not set.
      • parseArgument

        public int parseArgument​(String[] args,
                                 int i)
                          throws BadCommandLineException
        Parses an option args[i] and return the number of tokens consumed.
        Returns:
        0 if the argument is not understood. Returning 0 will let the caller report an error.
        Throws:
        BadCommandLineException - If the callee wants to provide a custom message for an error.
      • addCatalog

        public void addCatalog​(File catalogFile)
                        throws IOException
        Adds a new catalog file.Use created or existed resolver to parse new catalog file.
        Throws:
        IOException
      • guessSchemaLanguage

        public Language guessSchemaLanguage()
        Guesses the schema language.
      • createCodeWriter

        public CodeWriter createCodeWriter()
                                    throws IOException
        Creates a configured CodeWriter that produces files into the specified directory.
        Throws:
        IOException
      • createCodeWriter

        public CodeWriter createCodeWriter​(CodeWriter core)
        Creates a configured CodeWriter that produces files into the specified directory.
      • getPrologComment

        public String getPrologComment()
        Gets the string suitable to be used as the prolog comment baked into artifacts.This is the string like "This file was generated by the JAXB RI on YYYY/mm/dd..."
      • getBuildID

        public static String getBuildID()
      • normalizeSystemId

        public static String normalizeSystemId​(String systemId)