com.sun.tools.xjc.api.impl.s2j
Class JAXBModelImpl

java.lang.Object
  extended by com.sun.tools.xjc.api.impl.s2j.JAXBModelImpl
All Implemented Interfaces:
JAXBModel, S2JJAXBModel

final class JAXBModelImpl
extends Object
implements S2JJAXBModel

JAXBModel implementation.


Field Summary
(package private)  Outline outline
           
 
Constructor Summary
JAXBModelImpl(Outline outline)
           
 
Method Summary
 com.sun.codemodel.JCodeModel generateCode(Plugin[] extensions, ErrorListener errorListener)
          Generates artifacts.
 Mapping get(QName elementName)
          Gets a Mapping object for the given global element.
 List<com.sun.codemodel.JClass> getAllObjectFactories()
          Gets all the ObjectFactory classes generated by the compilation.
 List<String> getClassList()
          Returns a list of fully-qualified class names, which should be used at the runtime to create a new JAXBContext.
 TypeAndAnnotation getJavaType(QName xmlTypeName)
          Returns the fully-qualified name of the Java type that is bound to the specified XML type.
 Collection<? extends Mapping> getMappings()
          Gets a read-only view of all the Mappings.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

outline

final Outline outline
Constructor Detail

JAXBModelImpl

JAXBModelImpl(Outline outline)
Method Detail

generateCode

public com.sun.codemodel.JCodeModel generateCode(Plugin[] extensions,
                                                 ErrorListener errorListener)
Description copied from interface: S2JJAXBModel
Generates artifacts.

TODO: if JAXB supports various modes of code generations (such as public interface only or implementation only or etc), we should define bit flags to control those.

This operation is only supported for a model built from a schema.

Specified by:
generateCode in interface S2JJAXBModel
Parameters:
extensions - The JAXB RI extensions to run. This can be null or empty array if the caller wishes not to run any extension.
Those specified extensions will participate in the code generation. Specifying an extension in this list has the same effect of turning that extension on via command line.
It is the caller's responsibility to configure each augmenter properly by using Plugin.parseArgument(Options, String[], int).
Returns:
object filled with the generated code. Use JCodeModel.build(CodeWriter) to write them to a disk.

getAllObjectFactories

public List<com.sun.codemodel.JClass> getAllObjectFactories()
Description copied from interface: S2JJAXBModel
Gets all the ObjectFactory classes generated by the compilation.

This should be used for generating XmlSeeAlso on the SEI.

Specified by:
getAllObjectFactories in interface S2JJAXBModel

get

public final Mapping get(QName elementName)
Description copied from interface: S2JJAXBModel
Gets a Mapping object for the given global element.

Specified by:
get in interface S2JJAXBModel
Returns:
null if the element name is not a defined global element in the schema.

getMappings

public final Collection<? extends Mapping> getMappings()
Description copied from interface: S2JJAXBModel
Gets a read-only view of all the Mappings.

Specified by:
getMappings in interface S2JJAXBModel

getJavaType

public TypeAndAnnotation getJavaType(QName xmlTypeName)
Description copied from interface: S2JJAXBModel
Returns the fully-qualified name of the Java type that is bound to the specified XML type.

Specified by:
getJavaType in interface S2JJAXBModel
Parameters:
xmlTypeName - must not be null.
Returns:
null if the XML type is not bound to any Java type.

getClassList

public final List<String> getClassList()
Description copied from interface: JAXBModel
Returns a list of fully-qualified class names, which should be used at the runtime to create a new JAXBContext.

Until the JAXB team fixes the bootstrapping issue, we have two bootstrapping methods. This one is to use a list of class names to call JAXBContext.newInstance(Class[]) method. If this method returns non-null, the caller is expected to use that method. This is meant to be a temporary workaround.

Specified by:
getClassList in interface JAXBModel
Returns:
non-null read-only list.