|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.sun.tools.xjc.model.Model
public final class Model
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 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. |
XSSchemaSet |
schemaComponent
If this model was built from XML Schema, this field stores the root object of the parse schema model. |
boolean |
serializable
True to generate serializable classes. |
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,
NameConverter nc,
ClassNameAllocator allocator,
XSSchemaSet schemaComponent)
|
Method Summary | |
---|---|
(package private) void |
add(CClassInfo ci)
|
(package private) void |
add(CElementInfo ei)
|
(package private) void |
add(CEnumLeafInfo e)
|
Map<NType,? extends CArrayInfo> |
arrays()
No array mapping generation for XJC. |
Map<NClass,CClassInfo> |
beans()
Returns all the ClassInfo s known to this set. |
Map<NType,? extends CBuiltinLeafInfo> |
builtins()
Returns all the BuiltinLeafInfo s known to this set. |
Map<QName,CClassInfo> |
createTopLevelBindings()
Represents the "top-level binding". |
void |
dump(Result out)
Dumps this model into XML. |
Map<NClass,CEnumLeafInfo> |
enums()
Returns all the EnumLeafInfo s known to this set. |
Outline |
generateCode(Options opt,
ErrorReceiver receiver)
Fully-generate the source code into the given model. |
Iterable<? extends CElementInfo> |
getAllElements()
Returns all the ElementInfo known to this set. |
CBuiltinLeafInfo |
getAnyTypeInfo()
Gets the TypeInfo for the any type. |
XmlNsForm |
getAttributeFormDefault(String nsUri)
Gets the reasonable XmlNsForm for the given namespace URI. |
CClassInfo |
getClassInfo(NClass t)
Returns a ClassInfo , ArrayInfo , or LeafInfo
for the given bean. |
CCustomizations |
getCustomizations()
Gets the global customizations. |
XmlNsForm |
getElementFormDefault(String nsUri)
Gets the reasonable XmlNsForm for the given namespace URI. |
CElementInfo |
getElementInfo(NClass scope,
QName name)
Returns a ElementInfo for the given element. |
Map<QName,CElementInfo> |
getElementMappings(NClass scope)
Returns all ElementInfo s in the given scope. |
Locator |
getLocator()
Deprecated. No line number available for the "root" component. |
NameConverter |
getNameConverter()
Gets the name converter that shall be used to parse XML names into Java names. |
Navigator<NType,NClass,Void,Void> |
getNavigator()
Navigator for this model. |
CClassInfoParent.Package |
getPackage(com.sun.codemodel.JPackage pkg)
|
XSComponent |
getSchemaComponent()
Deprecated. Always return null. Perhaps you are interested in schemaComponent ? |
Map<String,String> |
getSchemaLocations()
Gets XmlSchema.location() found in this context. |
SymbolSpace |
getSymbolSpace(String name)
|
CNonElement |
getTypeInfo(NType type)
Returns a TypeInfo for the given type. |
CNonElement |
getTypeInfo(Ref<NType,NClass> ref)
Returns a type information for the given reference. |
Map<String,String> |
getXmlNs(String namespaceUri)
Not implemented in the compile-time model. |
boolean |
isPackageLevelAnnotations()
|
void |
setNameConverter(NameConverter nameConverter)
|
void |
setPackageLevelAnnotations(boolean packageLevelAnnotations)
|
Map<QName,TypeUse> |
typeUses()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
CCustomizations customizations
CCustomizations
that belong to this model.
CCustomizations.next
public final XSSchemaSet schemaComponent
public final com.sun.codemodel.JCodeModel codeModel
public final Options options
public boolean serializable
public Long serialVersionUID
public com.sun.codemodel.JClass rootClass
public com.sun.codemodel.JClass rootInterface
public ImplStructureStrategy strategy
final ClassNameAllocatorWrapper allocator
Model classes are responsible for using the allocator. This allocator interaction should be transparent to the user/builder of the model.
public final SymbolSpace defaultSymbolSpace
static final Locator EMPTY_LOCATOR
Constructor Detail |
---|
public Model(Options opts, com.sun.codemodel.JCodeModel cm, NameConverter nc, ClassNameAllocator allocator, XSSchemaSet schemaComponent)
nc
- Usually this should be set in the constructor, but we do allow this parameter
to be initially null, and then set later.schemaComponent
- The source schema model, if this is built from XSD.Method Detail |
---|
public void setNameConverter(NameConverter nameConverter)
public final NameConverter getNameConverter()
public boolean isPackageLevelAnnotations()
public void setPackageLevelAnnotations(boolean packageLevelAnnotations)
public SymbolSpace getSymbolSpace(String name)
public Outline generateCode(Options opt, ErrorReceiver receiver)
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.
public final Map<QName,CClassInfo> createTopLevelBindings()
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.
public Navigator<NType,NClass,Void,Void> getNavigator()
TypeInfoSet
Navigator
for this model.
getNavigator
in interface TypeInfoSet<NType,NClass,Void,Void>
public CNonElement getTypeInfo(NType type)
TypeInfoSet
TypeInfo
for the given type.
getTypeInfo
in interface TypeInfoSet<NType,NClass,Void,Void>
public CBuiltinLeafInfo getAnyTypeInfo()
TypeInfoSet
TypeInfo
for the any type.
getAnyTypeInfo
in interface TypeInfoSet<NType,NClass,Void,Void>
public CNonElement getTypeInfo(Ref<NType,NClass> ref)
TypeInfoSet
getTypeInfo
in interface TypeInfoSet<NType,NClass,Void,Void>
public Map<NClass,CClassInfo> beans()
TypeInfoSet
ClassInfo
s known to this set.
beans
in interface TypeInfoSet<NType,NClass,Void,Void>
public Map<NClass,CEnumLeafInfo> enums()
TypeInfoSet
EnumLeafInfo
s known to this set.
enums
in interface TypeInfoSet<NType,NClass,Void,Void>
public Map<QName,TypeUse> typeUses()
public Map<NType,? extends CArrayInfo> arrays()
arrays
in interface TypeInfoSet<NType,NClass,Void,Void>
public Map<NType,? extends CBuiltinLeafInfo> builtins()
TypeInfoSet
BuiltinLeafInfo
s known to this set.
builtins
in interface TypeInfoSet<NType,NClass,Void,Void>
public CClassInfo getClassInfo(NClass t)
TypeInfoSet
ClassInfo
, ArrayInfo
, or LeafInfo
for the given bean.
This method is almost like refinement of TypeInfoSet.getTypeInfo(Object)
except
our C cannot derive from T.
getClassInfo
in interface TypeInfoSet<NType,NClass,Void,Void>
public CElementInfo getElementInfo(NClass scope, QName name)
TypeInfoSet
ElementInfo
for the given element.
getElementInfo
in interface TypeInfoSet<NType,NClass,Void,Void>
scope
- if null, return the info about a global element.
Otherwise return a local element in the given scope if available,
then look for a global element next.public Map<QName,CElementInfo> getElementMappings(NClass scope)
TypeInfoSet
ElementInfo
s in the given scope.
getElementMappings
in interface TypeInfoSet<NType,NClass,Void,Void>
scope
- if non-null, this method only returns the local element mapping.public Iterable<? extends CElementInfo> getAllElements()
TypeInfoSet
ElementInfo
known to this set.
getAllElements
in interface TypeInfoSet<NType,NClass,Void,Void>
public XSComponent getSchemaComponent()
schemaComponent
?
CCustomizable
getSchemaComponent
in interface CCustomizable
public Locator getLocator()
CCustomizable
getLocator
in interface CCustomizable
public CCustomizations getCustomizations()
getCustomizations
in interface CCustomizable
Plugin.getCustomizationURIs()
public Map<String,String> getXmlNs(String namespaceUri)
getXmlNs
in interface TypeInfoSet<NType,NClass,Void,Void>
public Map<String,String> getSchemaLocations()
TypeInfoSet
XmlSchema.location()
found in this context.
This operation is expected to be only used in schema generator, so it can be slow.
getSchemaLocations
in interface TypeInfoSet<NType,NClass,Void,Void>
public XmlNsForm getElementFormDefault(String nsUri)
TypeInfoSet
XmlNsForm
for the given namespace URI.
The spec doesn't define very precisely what the XmlNsForm
value
for the given namespace would be, so this method is implemented in rather
ad-hoc way. It should work as what most people expect for simple cases.
getElementFormDefault
in interface TypeInfoSet<NType,NClass,Void,Void>
public XmlNsForm getAttributeFormDefault(String nsUri)
TypeInfoSet
XmlNsForm
for the given namespace URI.
The spec doesn't define very precisely what the XmlNsForm
value
for the given namespace would be, so this method is implemented in rather
ad-hoc way. It should work as what most people expect for simple cases.
getAttributeFormDefault
in interface TypeInfoSet<NType,NClass,Void,Void>
public void dump(Result out)
TypeInfoSet
dump
in interface TypeInfoSet<NType,NClass,Void,Void>
void add(CEnumLeafInfo e)
void add(CClassInfo ci)
void add(CElementInfo ei)
public CClassInfoParent.Package getPackage(com.sun.codemodel.JPackage pkg)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |