com.sun.tools.xjc.model
Class Model

java.lang.Object
  extended by com.sun.tools.xjc.model.Model
All Implemented Interfaces:
com.sun.xml.bind.v2.model.core.TypeInfoSet<NType,NClass,java.lang.Void,java.lang.Void>

public final class Model
extends java.lang.Object
implements com.sun.xml.bind.v2.model.core.TypeInfoSet<NType,NClass,java.lang.Void,java.lang.Void>

Root of the object model that represents the code that needs to be generated.

A Model is a schema language neutral representation of the result of a scehma parsing. The back-end then works against this model to turn this into a series of Java source code.


Field Summary
(package private)  ClassNameAllocatorWrapper allocator
          This allocator has the final say on deciding the class name.
 com.sun.codemodel.JCodeModel codeModel
          This model uses this code model exclusively.
(package private)  CCustomizations customizations
          Single linked list that connects all CCustomizations that belong to this model.
 SymbolSpace defaultSymbolSpace
          Default ID/IDREF symbol space.
(package private) static org.xml.sax.Locator EMPTY_LOCATOR
           
 Options options
          Command-line options used for building this model.
 com.sun.codemodel.JClass rootClass
          If non-null, all the generated classes should eventually derive from this class.
 com.sun.codemodel.JClass rootInterface
          If non-null, all the generated interfaces should eventually derive from this interface.
 boolean serializable
          True to generate serializable classes.
 java.lang.Long serialVersionUID
          serial version UID to be generated.
 ImplStructureStrategy strategy
          Specifies the code generation strategy.
 
Constructor Summary
Model(Options opts, com.sun.codemodel.JCodeModel cm, com.sun.xml.bind.api.impl.NameConverter nc, ClassNameAllocator allocator)
           
 
Method Summary
(package private)  void add(CClassInfo ci)
           
(package private)  void add(CElementInfo ei)
           
(package private)  void add(CEnumLeafInfo e)
           
 java.util.Map<NType,? extends CArrayInfo> arrays()
          No array mapping generation for XJC.
 java.util.Map<NClass,CClassInfo> beans()
           
 java.util.Map<NType,? extends CBuiltinLeafInfo> builtins()
           
 java.util.Map<javax.xml.namespace.QName,CClassInfo> createTopLevelBindings()
          Represents the "top-level binding".
 void dump(javax.xml.transform.Result out)
           
 java.util.Map<NClass,CEnumLeafInfo> enums()
           
 Outline generateCode(Options opt, ErrorReceiver receiver)
          Fully-generate the source code into the given model.
 java.lang.Iterable<? extends CElementInfo> getAllElements()
           
 CBuiltinLeafInfo getAnyTypeInfo()
           
 javax.xml.bind.annotation.XmlNsForm getAttributeFormDefault(java.lang.String nsUri)
           
 CClassInfo getClassInfo(NClass t)
           
 javax.xml.bind.annotation.XmlNsForm getElementFormDefault(java.lang.String nsUri)
           
 CElementInfo getElementInfo(NClass scope, javax.xml.namespace.QName name)
           
 java.util.Map<javax.xml.namespace.QName,CElementInfo> getElementMappings(NClass scope)
           
 com.sun.xml.bind.api.impl.NameConverter getNameConverter()
          Gets the name converter that shall be used to parse XML names into Java names.
 com.sun.xml.bind.v2.model.nav.Navigator<NType,NClass,java.lang.Void,java.lang.Void> getNavigator()
           
 CClassInfoParent.Package getPackage(com.sun.codemodel.JPackage pkg)
           
 SymbolSpace getSymbolSpace(java.lang.String name)
           
 CNonElement getTypeInfo(NType type)
           
 CNonElement getTypeInfo(com.sun.xml.bind.v2.model.core.Ref<NType,NClass> ref)
           
 java.util.Map<java.lang.String,java.lang.String> getXmlNs(java.lang.String namespaceUri)
          Not implemented in the compile-time model.
 boolean isPackageLevelAnnotations()
           
 void setNameConverter(com.sun.xml.bind.api.impl.NameConverter nameConverter)
           
 void setPackageLevelAnnotations(boolean packageLevelAnnotations)
           
 java.util.Map<javax.xml.namespace.QName,TypeUse> typeUses()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

customizations

CCustomizations customizations
Single linked list that connects all CCustomizations that belong to this model.

See Also:
CCustomizations.next

codeModel

public final com.sun.codemodel.JCodeModel codeModel
This model uses this code model exclusively.


options

public final Options options
Command-line options used for building this model.


serializable

public boolean serializable
True to generate serializable classes.


serialVersionUID

public java.lang.Long serialVersionUID
serial version UID to be generated. null if not to generate serialVersionUID field.


rootClass

public com.sun.codemodel.JClass rootClass
If non-null, all the generated classes should eventually derive from this class.


rootInterface

public com.sun.codemodel.JClass rootInterface
If non-null, all the generated interfaces should eventually derive from this interface.


strategy

public ImplStructureStrategy strategy
Specifies the code generation strategy. Must not be null.


allocator

final ClassNameAllocatorWrapper allocator
This allocator has the final say on deciding the class name. Must not be null.

Model classes are responsible for using the allocator. This allocator interaction should be transparent to the user/builder of the model.


defaultSymbolSpace

public final SymbolSpace defaultSymbolSpace
Default ID/IDREF symbol space. Any ID/IDREF without explicit reference to a symbol space is assumed to use this default symbol space.


EMPTY_LOCATOR

static final org.xml.sax.Locator EMPTY_LOCATOR
Constructor Detail

Model

public Model(Options opts,
             com.sun.codemodel.JCodeModel cm,
             com.sun.xml.bind.api.impl.NameConverter nc,
             ClassNameAllocator allocator)
Parameters:
nc - Usually this should be set in the constructor, but we do allow this parameter to be initially null, and then set later.
Method Detail

setNameConverter

public void setNameConverter(com.sun.xml.bind.api.impl.NameConverter nameConverter)

getNameConverter

public final com.sun.xml.bind.api.impl.NameConverter getNameConverter()
Gets the name converter that shall be used to parse XML names into Java names.


isPackageLevelAnnotations

public boolean isPackageLevelAnnotations()

setPackageLevelAnnotations

public void setPackageLevelAnnotations(boolean packageLevelAnnotations)

getSymbolSpace

public SymbolSpace getSymbolSpace(java.lang.String name)

generateCode

public Outline generateCode(Options opt,
                            ErrorReceiver receiver)
Fully-generate the source code into the given model.

Returns:
null if there was any errors. Otherwise it returns a valid Outline object, which captures how the model objects are mapped to the generated source code.

Add-ons can use those information to further augment the generated source code.


createTopLevelBindings

public final java.util.Map<javax.xml.namespace.QName,CClassInfo> createTopLevelBindings()
Represents the "top-level binding".

This is used to support the use of a schema inside WSDL. For XML Schema, the top-level binding is a map from global element declarations to its representation class.

For other schema languages, it should follow the appendicies in WSDL (but in practice no one would use WSDL with a schema language other than XML Schema, so it doesn't really matter.)

This needs to be filled by the front-end.


getNavigator

public com.sun.xml.bind.v2.model.nav.Navigator<NType,NClass,java.lang.Void,java.lang.Void> getNavigator()
Specified by:
getNavigator in interface com.sun.xml.bind.v2.model.core.TypeInfoSet<NType,NClass,java.lang.Void,java.lang.Void>

getTypeInfo

public CNonElement getTypeInfo(NType type)
Specified by:
getTypeInfo in interface com.sun.xml.bind.v2.model.core.TypeInfoSet<NType,NClass,java.lang.Void,java.lang.Void>

getAnyTypeInfo

public CBuiltinLeafInfo getAnyTypeInfo()
Specified by:
getAnyTypeInfo in interface com.sun.xml.bind.v2.model.core.TypeInfoSet<NType,NClass,java.lang.Void,java.lang.Void>

getTypeInfo

public CNonElement getTypeInfo(com.sun.xml.bind.v2.model.core.Ref<NType,NClass> ref)
Specified by:
getTypeInfo in interface com.sun.xml.bind.v2.model.core.TypeInfoSet<NType,NClass,java.lang.Void,java.lang.Void>

beans

public java.util.Map<NClass,CClassInfo> beans()
Specified by:
beans in interface com.sun.xml.bind.v2.model.core.TypeInfoSet<NType,NClass,java.lang.Void,java.lang.Void>

enums

public java.util.Map<NClass,CEnumLeafInfo> enums()
Specified by:
enums in interface com.sun.xml.bind.v2.model.core.TypeInfoSet<NType,NClass,java.lang.Void,java.lang.Void>

typeUses

public java.util.Map<javax.xml.namespace.QName,TypeUse> typeUses()

arrays

public java.util.Map<NType,? extends CArrayInfo> arrays()
No array mapping generation for XJC.

Specified by:
arrays in interface com.sun.xml.bind.v2.model.core.TypeInfoSet<NType,NClass,java.lang.Void,java.lang.Void>

builtins

public java.util.Map<NType,? extends CBuiltinLeafInfo> builtins()
Specified by:
builtins in interface com.sun.xml.bind.v2.model.core.TypeInfoSet<NType,NClass,java.lang.Void,java.lang.Void>

getClassInfo

public CClassInfo getClassInfo(NClass t)
Specified by:
getClassInfo in interface com.sun.xml.bind.v2.model.core.TypeInfoSet<NType,NClass,java.lang.Void,java.lang.Void>

getElementInfo

public CElementInfo getElementInfo(NClass scope,
                                   javax.xml.namespace.QName name)
Specified by:
getElementInfo in interface com.sun.xml.bind.v2.model.core.TypeInfoSet<NType,NClass,java.lang.Void,java.lang.Void>

getElementMappings

public java.util.Map<javax.xml.namespace.QName,CElementInfo> getElementMappings(NClass scope)
Specified by:
getElementMappings in interface com.sun.xml.bind.v2.model.core.TypeInfoSet<NType,NClass,java.lang.Void,java.lang.Void>

getAllElements

public java.lang.Iterable<? extends CElementInfo> getAllElements()
Specified by:
getAllElements in interface com.sun.xml.bind.v2.model.core.TypeInfoSet<NType,NClass,java.lang.Void,java.lang.Void>

getXmlNs

public java.util.Map<java.lang.String,java.lang.String> getXmlNs(java.lang.String namespaceUri)
Not implemented in the compile-time model.

Specified by:
getXmlNs in interface com.sun.xml.bind.v2.model.core.TypeInfoSet<NType,NClass,java.lang.Void,java.lang.Void>

getElementFormDefault

public javax.xml.bind.annotation.XmlNsForm getElementFormDefault(java.lang.String nsUri)
Specified by:
getElementFormDefault in interface com.sun.xml.bind.v2.model.core.TypeInfoSet<NType,NClass,java.lang.Void,java.lang.Void>

getAttributeFormDefault

public javax.xml.bind.annotation.XmlNsForm getAttributeFormDefault(java.lang.String nsUri)
Specified by:
getAttributeFormDefault in interface com.sun.xml.bind.v2.model.core.TypeInfoSet<NType,NClass,java.lang.Void,java.lang.Void>

dump

public void dump(javax.xml.transform.Result out)
Specified by:
dump in interface com.sun.xml.bind.v2.model.core.TypeInfoSet<NType,NClass,java.lang.Void,java.lang.Void>

add

void add(CEnumLeafInfo e)

add

void add(CClassInfo ci)

add

void add(CElementInfo ei)

getPackage

public CClassInfoParent.Package getPackage(com.sun.codemodel.JPackage pkg)