|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.sun.tools.xjc.ErrorReceiver
com.sun.tools.xjc.api.impl.s2j.SchemaCompilerImpl
public final class SchemaCompilerImpl
SchemaCompiler implementation.
This class builds a DOMForest until the bind() method,
then this method does the rest of the hard work.
ModelLoader| Field Summary | |
|---|---|
protected DOMForest |
forest
|
protected Options |
opts
|
| Constructor Summary | |
|---|---|
SchemaCompilerImpl()
|
|
| Method Summary | |
|---|---|
com.sun.tools.xjc.api.impl.s2j.JAXBModelImpl |
bind()
Obtains the compiled schema object model. |
void |
error(SAXParseException exception)
|
void |
fatalError(SAXParseException exception)
|
void |
forcePackageName(String packageName)
Forces all the JAXB-generated classes to go into the specific package. |
Options |
getOptions()
Allows the calling code to tweak more schema compilation details. |
ContentHandler |
getParserHandler(String systemId)
Parses schemas or external bindings through SAX events by feeding events into SAX ContentHandler. |
void |
info(SAXParseException exception)
Reports verbose messages to users. |
void |
parseSchema(InputSource source)
Parses a schema or an external binding file from an external source. |
void |
parseSchema(String systemId,
Element element)
Parses a schema or an external binding file from the specified DOM element. |
void |
parseSchema(String systemId,
XMLStreamReader reader)
Parses a schema or an external binding file from the given source. |
void |
resetSchema()
Clears all the schema files parsed so far. |
void |
setClassNameAllocator(ClassNameAllocator allocator)
Sets the ClassNameAllocator to be used for the binding operation. |
void |
setDefaultPackageName(String packageName)
Sets the default Java package name into which the generated code will be placed. |
void |
setEntityResolver(EntityResolver entityResolver)
|
void |
setErrorListener(ErrorListener errorListener)
|
void |
setTargetVersion(SpecVersion version)
Specifies the target spec version for this compilaion. |
void |
warning(SAXParseException exception)
|
| Methods inherited from class com.sun.tools.xjc.ErrorReceiver |
|---|
debug, error, error, error, error, getLocationString, pollAbort, warning |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected final Options opts
@NotNull protected DOMForest forest
| Constructor Detail |
|---|
public SchemaCompilerImpl()
| Method Detail |
|---|
@NotNull public Options getOptions()
SchemaCompiler
The caller can use this method to obtain an Options instance,
then tweak settings on it. The updated settings will be used when the
SchemaCompiler.bind() method is invoked.
The returned Options object is useful for example to specify
command-line arguments.
getOptions in interface SchemaCompilerpublic ContentHandler getParserHandler(String systemId)
SchemaCompilerContentHandler.
getParserHandler in interface SchemaCompilersystemId - The system ID of the document to be read in.SchemaCompiler.parseSchema(String, XMLStreamReader)
public void parseSchema(String systemId,
Element element)
SchemaCompilerThe given DOM element is treated as if it's the root of a virtual document.
XJC will not be able to print location information for errors found in this document, since DOM doesn't have them. For this reason, use of this method is strongly discouraged.
parseSchema in interface SchemaCompilersystemId - We need an absolute system ID that uniquely designates the virtual
document. This should be different from the system ID of
the document which contains this element.
One way to do that is by adding a fragment identifier to the system ID of the document. For example, if the document is "foo.wsdl" and you are passing in its types section, you can use an unique identifier like "foo.wsdl#types"
public void parseSchema(InputSource source)
SchemaCompiler
parseSchema in interface SchemaCompilersource - Its system Id must be set to an absolute URI.public void setTargetVersion(SpecVersion version)
SchemaCompiler
setTargetVersion in interface SchemaCompilerversion - If null, XJC will generate the source code that
takes advantage of the latest JAXB spec that it understands.
public void parseSchema(String systemId,
XMLStreamReader reader)
throws XMLStreamException
SchemaCompilerA stream reader must be pointing at the element or at the start of the document. XML is parsed until the corresponding end tag, then the sub tree is processed as a schema document.
When this method returns successfully, the parser is at the next token of the end element.
parseSchema in interface SchemaCompilersystemId - The absolute system ID of the document that is being parsed.
This information is necessary to avoid double-inclusion
and etc.
Note that XMLStreamReader.getLocation() only
returns the system ID of the entity it is parsing, not
necessarily the system ID of the document itself.
XMLStreamException - If an error happens while parsing a document.
Note that not only the parser but also the XJC itself
may throw this error (as a result of the additional validation
for example.)public void setEntityResolver(EntityResolver entityResolver)
setEntityResolver in interface SchemaCompilerpublic void setDefaultPackageName(String packageName)
SchemaCompilerCustomizations in the binding files/schemas will have precedence over this setting. Set to null to use the default package name computation algorithm as specified by the JAXB spec (which is the default behavior.)
Initially this parameter is set to null.
setDefaultPackageName in interface SchemaCompilerpackageName - Java pckage name such as "org.foo.bar". Use "" to represent the root package,
and null to defer to the default computation algorithm.SchemaCompiler.forcePackageName(String)public void forcePackageName(String packageName)
SchemaCompiler
This setting takes precedence over the SchemaCompiler.setDefaultPackageName(String)
or any of the customization found in the JAXB binding files. This method
is designed to implement the semantics of the command-line '-p' option.
This somewhat ugly semantics actually have a long history now and too late to change.
forcePackageName in interface SchemaCompilerSchemaCompiler.setDefaultPackageName(String)public void setClassNameAllocator(ClassNameAllocator allocator)
SchemaCompilerClassNameAllocator to be used for the binding operation.
This mechanism would allow the caller to participate in the binding operation.
setClassNameAllocator in interface SchemaCompilerClassNameAllocatorpublic void resetSchema()
SchemaCompiler
resetSchema in interface SchemaCompilerpublic com.sun.tools.xjc.api.impl.s2j.JAXBModelImpl bind()
SchemaCompilerSchemaCompiler.
bind in interface SchemaCompilerpublic void setErrorListener(ErrorListener errorListener)
setErrorListener in interface SchemaCompilerpublic void info(SAXParseException exception)
ErrorReceiver
info in interface ErrorListenerinfo in class ErrorReceiverpublic void warning(SAXParseException exception)
warning in interface ErrorListenerwarning in interface ErrorHandlerwarning in class ErrorReceiverpublic void error(SAXParseException exception)
error in interface ErrorListenererror in interface ErrorHandlererror in class ErrorReceiverpublic void fatalError(SAXParseException exception)
fatalError in interface ErrorListenerfatalError in interface ErrorHandlerfatalError in class ErrorReceiver
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||