public class Options extends Object
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.
Modifier and Type | Field and Description |
---|---|
List<Plugin> |
activePlugins
Plugin s that are enabled in this compilation. |
boolean |
automaticNameConflictResolution
If true, try to resolve name conflicts automatically by assigning mechanical numbers.
|
ClassNameAllocator |
classNameAllocator
This allocator has the final say on deciding the class name.
|
List<URL> |
classpaths |
int |
compatibilityMode
this switch determines how carefully the compiler will follow
the compatibility rules in the spec.
|
boolean |
contentForWildcard
When on, generates content property for types with multiple xs:any derived elements (which is supposed to be correct behaviour)
|
boolean |
debugMode
If "-debug" is specified.
|
String |
defaultPackage
The -p option that should control the default Java package that
will contain the generated code.
|
String |
defaultPackage2
Similar to the -p option, but this one works with a lower priority,
and customizations overrides this.
|
boolean |
disableXmlSecurity
If true XML security features when parsing XML documents will be disabled.
|
boolean |
enableIntrospection
When on, fixes getter/setter generation to match the Bean Introspection API
|
String |
encoding
Encoding to be used by generated java sources, null for platform default.
|
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. |
static int |
EXTENSION
loosely follow the compatibility rules and allow the use of vendor
binding extensions
|
boolean |
noFileHeader
No file header comment (to be more friendly with diff.)
|
boolean |
packageLevelAnnotations
This switch controls whether or not xjc will generate package level annotations
|
Set<String> |
pluginURIs
Set of URIs that plug-ins recognize as extension bindings.
|
String |
proxyAuth |
boolean |
quiet
If the "-quiet" option is specified.
|
boolean |
readOnly
If the -readOnly option is specified.
|
boolean |
runtime14
If -explicit-annotation option is specified.
|
static int |
STRICT
strictly follow the compatibility rules and reject schemas that
contain features from App.
|
boolean |
strictCheck
Check the source schemas with extra scrutiny.
|
SpecVersion |
target
Generates output for the specified version of the runtime.
|
File |
targetDir
Target directory when producing files.
|
boolean |
verbose
If the "-verbose" option is specified.
|
Constructor and Description |
---|
Options() |
Modifier and Type | Method and Description |
---|---|
void |
addBindFile(File bindFile)
Adds a new binding file.
|
void |
addBindFile(InputSource is)
Adds a new binding file.
|
void |
addBindFileRecursive(File dir)
Recursively scan directories and add all ".xjb" files in it.
|
void |
addCatalog(File catalogFile)
Adds a new catalog file.Use created or existed resolver to parse new catalog file.
|
void |
addGrammar(File source) |
void |
addGrammar(InputSource is)
Adds a new input schema.
|
void |
addGrammarRecursive(File dir)
Recursively scan directories and add all XSD files in it.
|
CodeWriter |
createCodeWriter()
Creates a configured CodeWriter that produces files into the specified directory.
|
CodeWriter |
createCodeWriter(CodeWriter core)
Creates a configured CodeWriter that produces files into the specified directory.
|
List<Plugin> |
getAllPlugins()
Gets all the
Plugin s discovered so far. |
InputSource[] |
getBindFiles()
Input external binding files.
|
static String |
getBuildID() |
FieldRendererFactory |
getFieldRendererFactory()
Gets the active
FieldRendererFactory that shall be used to build Model . |
InputSource[] |
getGrammars()
Input schema files.
|
String |
getModuleName()
Gets Java module name option.
|
NameConverter |
getNameConverter()
Gets the active
NameConverter that shall be used to build Model . |
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..."
|
Language |
getSchemaLanguage() |
ClassLoader |
getUserClassLoader(ClassLoader parent)
Gets a classLoader that can load classes specified via the
-classpath option.
|
Language |
guessSchemaLanguage()
Guesses the schema language.
|
boolean |
isExtensionMode() |
static String |
normalizeSystemId(String systemId) |
int |
parseArgument(String[] args,
int i)
Parses an option
args[i] and return
the number of tokens consumed. |
void |
parseArguments(String[] args)
Parses arguments and fill fields of this object.
|
String |
requireArgument(String optionName,
String[] args,
int i)
Obtains an operand and reports an error if it's not there.
|
void |
scanEpisodeFile(File jar)
Finds the
META-INF/sun-jaxb.episode file to add as a binding customization. |
void |
setFieldRendererFactory(FieldRendererFactory frf,
Plugin owner)
Sets the
FieldRendererFactory . |
void |
setNameConverter(NameConverter nc,
Plugin owner)
Sets the
NameConverter . |
void |
setSchemaLanguage(Language _schemaLanguage) |
public boolean debugMode
public boolean verbose
public boolean quiet
public boolean readOnly
public boolean noFileHeader
public boolean enableIntrospection
public boolean contentForWildcard
public String encoding
public boolean disableXmlSecurity
Boolean
public boolean strictCheck
public boolean runtime14
This generates code that works around issues specific to 1.4 runtime.
public boolean automaticNameConflictResolution
public static final int STRICT
public static final int EXTENSION
public int compatibilityMode
STRICT
or EXTENSION
.public SpecVersion target
public File targetDir
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)
.
public EntityResolver entityResolver
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.public String defaultPackage
public String defaultPackage2
public String proxyAuth
public final Set<String> pluginURIs
public ClassNameAllocator classNameAllocator
public boolean packageLevelAnnotations
public boolean isExtensionMode()
public FieldRendererFactory getFieldRendererFactory()
FieldRendererFactory
that shall be used to build Model
.public void setFieldRendererFactory(FieldRendererFactory frf, Plugin owner) throws BadCommandLineException
FieldRendererFactory
.
This method is for plugins to call to set a custom FieldRendererFactory
.
frf
- The FieldRendererFactory
to be installed. Must not be null.owner
- Identifies the plugin that owns this FieldRendererFactory
.
When two Plugin
s try to call this method, this allows XJC
to report it as a user-friendly error message.BadCommandLineException
- If a conflit happens, this exception carries a user-friendly error
message, indicating a conflict.public NameConverter getNameConverter()
NameConverter
that shall be used to build Model
.public void setNameConverter(NameConverter nc, Plugin owner) throws BadCommandLineException
nc
- The NameConverter
to be installed. Must not be null.owner
- Identifies the plugin that owns this NameConverter
.
When two Plugin
s try to call this method, this allows XJC
to report it as a user-friendly error message.BadCommandLineException
- If a conflit happens, this exception carries a user-friendly error
message, indicating a conflict.public List<Plugin> getAllPlugins()
Plugin
s 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.
public Language getSchemaLanguage()
public void setSchemaLanguage(Language _schemaLanguage)
public InputSource[] getGrammars()
public void addGrammar(InputSource is)
is
- public void addGrammar(File source)
public void addGrammarRecursive(File dir)
dir
- public InputSource[] getBindFiles()
public void addBindFile(InputSource is)
is
- public void addBindFile(File bindFile)
bindFile
- public void addBindFileRecursive(File dir)
dir
- public ClassLoader getUserClassLoader(ClassLoader parent)
parent
- public String getModuleName()
null
if this option was not set.public int parseArgument(String[] args, int i) throws BadCommandLineException
args[i]
and return
the number of tokens consumed.args
- i
- BadCommandLineException
- If the callee wants to provide a custom message for an error.public String requireArgument(String optionName, String[] args, int i) throws BadCommandLineException
optionName
- args
- i
- BadCommandLineException
public void addCatalog(File catalogFile) throws IOException
catalogFile
- IOException
public void parseArguments(String[] args) throws BadCommandLineException
args
- BadCommandLineException
- thrown when there's a problem in the command-line argumentspublic void scanEpisodeFile(File jar) throws BadCommandLineException
META-INF/sun-jaxb.episode
file to add as a binding customization.jar
- BadCommandLineException
public Language guessSchemaLanguage()
public CodeWriter createCodeWriter() throws IOException
IOException
public CodeWriter createCodeWriter(CodeWriter core)
core
- public String getPrologComment()
public static String getBuildID()
Copyright © 2019 JBoss by Red Hat. All rights reserved.