Class 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 Summary
FieldsModifier and TypeFieldDescriptionPlugins that are enabled in this compilation.booleanIf true, try to resolve name conflicts automatically by assigning mechanical numbers.This allocator has the final say on deciding the class name.intthis switch determines how carefully the compiler will follow the compatibility rules in the spec.booleanWhen on, generates content property for types with multiple xs:any derived elements (which is supposed to be correct behaviour)booleanIf "-debug" is specified.The -p option that should control the default Java package that will contain the generated code.Similar to the -p option, but this one works with a lower priority, and customizations overrides this.booleanIf true XML security features when parsing XML documents will be disabled.booleanWhen on, fixes getter/setter generation to match the Bean Introspection APIEncoding to be used by generated java sources, null for platform default.On JDK 8 an odler storesCatalogResolver, but the field type is made toEntityResolverso that XJC can be used even if resolver.jar is not available in the classpath.static final intloosely follow the compatibility rules and allow the use of vendor binding extensionsbooleanNo file header comment (to be more friendly with diff.)booleanThis switch controls whether or not xjc will generate package level annotationsSet of URIs that plug-ins recognize as extension bindings.booleanIf the "-quiet" option is specified.booleanIf the -readOnly option is specified.booleanIf -explicit-annotation option is specified.static final intstrictly follow the compatibility rules and reject schemas that contain features from App.booleanCheck the source schemas with extra scrutiny.Generates output for the specified version of the runtime.Target directory when producing files.booleanIf the "-verbose" option is specified. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddBindFile(File bindFile) Adds a new binding file.voidAdds a new binding file.voidaddBindFileRecursive(File dir) Recursively scan directories and add all ".xjb" files in it.voidaddCatalog(File catalogFile) Adds a new catalog file.Use created or existed resolver to parse new catalog file.voidaddGrammar(File source) voidAdds a new input schema.voidaddGrammarRecursive(File dir) Recursively scan directories and add all XSD files in it.Creates a configured CodeWriter that produces files into the specified directory.createCodeWriter(CodeWriter core) Creates a configured CodeWriter that produces files into the specified directory.Gets all thePlugins discovered so far.Input external binding files.static StringGets the activeFieldRendererFactorythat shall be used to buildModel.Input schema files.Gets Java module name option.org.glassfish.jaxb.core.api.impl.NameConverterGets the activeNameConverterthat shall be used to buildModel.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..."getUserClassLoader(ClassLoader parent) Gets a classLoader that can load classes specified via the -classpath option.Guesses the schema language.booleanstatic StringnormalizeSystemId(String systemId) intparseArgument(String[] args, int i) Parses an optionargs[i]and return the number of tokens consumed.voidparseArguments(String[] args) Parses arguments and fill fields of this object.requireArgument(String optionName, String[] args, int i) Obtains an operand and reports an error if it's not there.voidscanEpisodeFile(File jar) Finds theMETA-INF/sun-jaxb.episodefile to add as a binding customization.voidsetFieldRendererFactory(FieldRendererFactory frf, Plugin owner) Sets theFieldRendererFactory.voidsetNameConverter(org.glassfish.jaxb.core.api.impl.NameConverter nc, Plugin owner) Sets theNameConverter.voidsetSchemaLanguage(Language _schemaLanguage)
-
Field Details
-
debugMode
public boolean debugModeIf "-debug" is specified. -
verbose
public boolean verboseIf the "-verbose" option is specified. -
quiet
public boolean quietIf the "-quiet" option is specified. -
readOnly
public boolean readOnlyIf the -readOnly option is specified. -
noFileHeader
public boolean noFileHeaderNo file header comment (to be more friendly with diff.) -
enableIntrospection
public boolean enableIntrospectionWhen on, fixes getter/setter generation to match the Bean Introspection API -
contentForWildcard
public boolean contentForWildcardWhen on, generates content property for types with multiple xs:any derived elements (which is supposed to be correct behaviour) -
encoding
Encoding to be used by generated java sources, null for platform default. -
disableXmlSecurity
public boolean disableXmlSecurityIf true XML security features when parsing XML documents will be disabled. The default value is false.Boolean
- Since:
- 2.2.6
-
strictCheck
public boolean strictCheckCheck the source schemas with extra scrutiny. The exact meaning depends on the schema language. -
runtime14
public boolean runtime14If -explicit-annotation option is specified.This generates code that works around issues specific to 1.4 runtime.
-
automaticNameConflictResolution
public boolean automaticNameConflictResolutionIf true, try to resolve name conflicts automatically by assigning mechanical numbers. -
STRICT
public static final int STRICTstrictly follow the compatibility rules and reject schemas that contain features from App. E.2, use vendor binding extensions- See Also:
-
EXTENSION
public static final int EXTENSIONloosely follow the compatibility rules and allow the use of vendor binding extensions- See Also:
-
compatibilityMode
public int compatibilityModethis switch determines how carefully the compiler will follow the compatibility rules in the spec. EitherSTRICTorEXTENSION. -
classNameReplacer
-
target
Generates output for the specified version of the runtime. -
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
On JDK 8 an odler storesCatalogResolver, but the field type is made toEntityResolverso that XJC can be used even if resolver.jar is not available in the classpath. -
defaultPackage
The -p option that should control the default Java package that will contain the generated code. Null if unspecified. -
defaultPackage2
Similar to the -p option, but this one works with a lower priority, and customizations overrides this. Used by JAX-RPC. -
proxyAuth
-
activePlugins
Plugins that are enabled in this compilation. -
pluginURIs
Set of URIs that plug-ins recognize as extension bindings. -
classNameAllocator
This allocator has the final say on deciding the class name. -
packageLevelAnnotations
public boolean packageLevelAnnotationsThis switch controls whether or not xjc will generate package level annotations -
classpaths
-
-
Constructor Details
-
Options
public Options()
-
-
Method Details
-
isExtensionMode
public boolean isExtensionMode() -
getFieldRendererFactory
Gets the activeFieldRendererFactorythat shall be used to buildModel.- Returns:
- always non-null.
-
setFieldRendererFactory
public void setFieldRendererFactory(FieldRendererFactory frf, Plugin owner) throws BadCommandLineException Sets theFieldRendererFactory.This method is for plugins to call to set a custom
FieldRendererFactory.- Parameters:
frf- TheFieldRendererFactoryto be installed. Must not be null.owner- Identifies the plugin that owns thisFieldRendererFactory. When twoPlugins try to call this method, this allows XJC to report it as a user-friendly error message.- Throws:
BadCommandLineException- If a conflit happens, this exception carries a user-friendly error message, indicating a conflict.
-
getNameConverter
public org.glassfish.jaxb.core.api.impl.NameConverter getNameConverter()Gets the activeNameConverterthat shall be used to buildModel.- Returns:
- can be null, in which case it's up to the binding.
-
setNameConverter
public void setNameConverter(org.glassfish.jaxb.core.api.impl.NameConverter nc, Plugin owner) throws BadCommandLineException Sets theNameConverter.This method is for plugins to call to set a custom
NameConverter.- Parameters:
nc- TheNameConverterto be installed. Must not be null.owner- Identifies the plugin that owns thisNameConverter. When twoPlugins try to call this method, this allows XJC to report it as a user-friendly error message.- Throws:
BadCommandLineException- If a conflit happens, this exception carries a user-friendly error message, indicating a conflict.
-
getAllPlugins
Gets all thePlugins discovered so far.A plugins are enumerated when this method is called for the first time, by taking
classpathsinto account. That means "-cp plugin.jar" has to come before you specify options to enable it.- Returns:
-
getSchemaLanguage
-
setSchemaLanguage
-
getGrammars
Input schema files.- Returns:
-
addGrammar
Adds a new input schema.- Parameters:
is-
-
addGrammar
-
addGrammarRecursive
Recursively scan directories and add all XSD files in it.- Parameters:
dir-
-
getBindFiles
Input external binding files.- Returns:
-
addBindFile
Adds a new binding file.- Parameters:
is-
-
addBindFile
Adds a new binding file.- Parameters:
bindFile-
-
addBindFileRecursive
Recursively scan directories and add all ".xjb" files in it.- Parameters:
dir-
-
getUserClassLoader
Gets a classLoader that can load classes specified via the -classpath option.- Parameters:
parent-- Returns:
-
getModuleName
Gets Java module name option.- Returns:
- Java module name option or
nullif this option was not set.
-
parseArgument
Parses an optionargs[i]and return the number of tokens consumed.- Parameters:
args-i-- 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.
-
requireArgument
public String requireArgument(String optionName, String[] args, int i) throws BadCommandLineException Obtains an operand and reports an error if it's not there.- Parameters:
optionName-args-i-- Returns:
- Throws:
BadCommandLineException
-
addCatalog
Adds a new catalog file.Use created or existed resolver to parse new catalog file.- Parameters:
catalogFile-- Throws:
IOException
-
parseArguments
Parses arguments and fill fields of this object.- Parameters:
args-- Throws:
BadCommandLineException- thrown when there's a problem in the command-line arguments
-
scanEpisodeFile
Finds theMETA-INF/sun-jaxb.episodefile to add as a binding customization.- Parameters:
jar-- Throws:
BadCommandLineException
-
guessSchemaLanguage
Guesses the schema language.- Returns:
-
createCodeWriter
Creates a configured CodeWriter that produces files into the specified directory.- Returns:
- Throws:
IOException
-
createCodeWriter
Creates a configured CodeWriter that produces files into the specified directory.- Parameters:
core-- Returns:
-
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..."- Returns:
-
getBuildID
-
normalizeSystemId
-