public final class CEnumLeafInfo extends Object implements EnumLeafInfo<NType,NClass>, NClass, CNonElement
Modifier and Type | Field and Description |
---|---|
CNonElement |
base
Represents the underlying type of this enumeration
and its conversion.
|
String |
javadoc |
Collection<CEnumConstant> |
members
List of enum members.
|
Model |
model
The
Model object to which this bean belongs. |
CClassInfoParent |
parent
The parent into which the enum class should be generated.
|
String |
shortName
Short name of the generated type-safe enum.
|
ANYTYPE_NAME
Constructor and Description |
---|
CEnumLeafInfo(Model model,
QName typeName,
CClassInfoParent container,
String shortName,
CNonElement base,
Collection<CEnumConstant> _members,
com.sun.xml.xsom.XSComponent source,
CCustomizations customizations,
Locator _sourceLocator) |
Modifier and Type | Method and Description |
---|---|
Element<NType,NClass> |
asElement()
|
boolean |
canBeReferencedByIDREF()
Deprecated.
why are you calling the method whose return value is known?
|
JExpression |
createConstant(Outline outline,
com.sun.xml.xsom.XmlString literal)
Creates a constant for the given lexical value.
|
String |
fullName()
Human readable name of this type.
|
CAdapter |
getAdapterUse()
Deprecated.
|
NonElement<NType,NClass> |
getBaseType()
Returns the base type of the enumeration.
|
NClass |
getClazz()
The same as
TypeInfo.getType() but an EnumLeafInfo
is guaranteed to represent an enum declaration, which is a
kind of a class declaration. |
Collection<CEnumConstant> |
getConstants()
Returns the read-only list of enumeration constants.
|
CCustomizations |
getCustomizations()
Gets the list of customizations attached to this model component.
|
QName |
getElementName()
Gets the element name of the class, if the class is bound
to an element.
|
MimeType |
getExpectedMimeType()
A
TypeUse can have an associated MIME type. |
CNonElement |
getInfo()
Deprecated.
|
Location |
getLocation()
Gets the location object that this object points to.
|
Locator |
getLocator()
Source line information that points to the place
where this type-safe enum is defined.
|
com.sun.xml.xsom.XSComponent |
getSchemaComponent()
If this model object is built from XML Schema,
this property returns a schema component from which the model is built.
|
NType |
getType()
Gets the underlying Java type that object represents.
|
QName |
getTypeName()
Gets the primary XML type ANYTYPE_NAME of the class.
|
Locatable |
getUpstream()
Gets the upstream
Location information. |
ID |
idUse()
Whether the referenced type (individual item type in case of collection)
is ID/IDREF.
|
boolean |
isAbstract() |
boolean |
isBoxedType()
Returns true iff this type represents a class that has a unboxed form.
|
boolean |
isCollection()
Deprecated.
|
boolean |
isElement()
If the class is bound to an element, return true.
|
boolean |
isPrimitive() |
boolean |
isSimpleType()
Returns true if this
NonElement maps to text in XML,
without any attribute nor child elements. |
boolean |
needsValueField()
The spec says the value field in the enum class will be generated
only under certain circumstances.
|
JClass |
toType(Outline o,
Aspect aspect)
Returns the representation of this type in code model.
|
public final CClassInfoParent parent
public final String shortName
public final CNonElement base
To parse XML into a constant, we use the base type
to do lexical -> value
, then use a map to pick up the right one.
Hence this also represents the type of the Java value. For example, if this is an enumeration of xs:int, then this field will be Java int.
public final Collection<CEnumConstant> members
public String javadoc
public CEnumLeafInfo(Model model, QName typeName, CClassInfoParent container, String shortName, CNonElement base, Collection<CEnumConstant> _members, com.sun.xml.xsom.XSComponent source, CCustomizations customizations, Locator _sourceLocator)
public Locator getLocator()
getLocator
in interface CCustomizable
public QName getTypeName()
NonElement
A Java type can be mapped to multiple XML types, but one of them is considered "primary" and used when we generate a schema.
getTypeName
in interface NonElement<NType,NClass>
public NType getType()
TypeInfo
public boolean canBeReferencedByIDREF()
TypeInfo
XmlIDREF
.canBeReferencedByIDREF
in interface TypeInfo<NType,NClass>
public boolean isElement()
MaybeElement
Note that when this is true, the class is bound to both an element and a type.
isElement
in interface MaybeElement<NType,NClass>
public QName getElementName()
MaybeElement
getElementName
in interface MaybeElement<NType,NClass>
MaybeElement.isElement()
.public Element<NType,NClass> asElement()
MaybeElement
asElement
in interface MaybeElement<NType,NClass>
MaybeElement.isElement()
==false, non-null if MaybeElement.isElement()
==true.public NClass getClazz()
EnumLeafInfo
TypeInfo.getType()
but an EnumLeafInfo
is guaranteed to represent an enum declaration, which is a
kind of a class declaration.getClazz
in interface EnumLeafInfo<NType,NClass>
public com.sun.xml.xsom.XSComponent getSchemaComponent()
CCustomizable
getSchemaComponent
in interface CCustomizable
public JClass toType(Outline o, Aspect aspect)
NType
This operation requires the whole model to be built,
and hence it takes Outline
.
Under some code generation strategy, some bean classes are considered implementation specific (such as impl.FooImpl class) These classes always have accompanying "exposed" type (such as the Foo interface).
For such Jekyll and Hyde type, the aspect parameter determines which personality is returned.
toType
in interface CTypeInfo
toType
in interface NClass
toType
in interface NType
aspect
- If Aspect.IMPLEMENTATION
, this method returns the
implementation specific class that this type represents.
If Aspect.EXPOSED
, this method returns the
publicly exposed type that this type represents.
For ordinary classes, the aspect parameter is meaningless.NType.toType(Outline, com.sun.tools.xjc.outline.Aspect)
public boolean isAbstract()
isAbstract
in interface NClass
public boolean isBoxedType()
NType
String
this is false, but for Integer
this is true.isBoxedType
in interface NType
public String fullName()
NType
public boolean isPrimitive()
public boolean isSimpleType()
NonElement
NonElement
maps to text in XML,
without any attribute nor child elements.isSimpleType
in interface NonElement<NType,NClass>
public boolean needsValueField()
public JExpression createConstant(Outline outline, com.sun.xml.xsom.XmlString literal)
TypeUse
For example, to create a constant 1 for xs:int
, you'd do:
CBuiltinLeafInfo.INT.createConstant( codeModel, "1", null );
This method is invoked at the backend as a part of the code generation process.
createConstant
in interface TypeUse
TypeUse
(such as when it's a collection)@Deprecated public boolean isCollection()
CNonElement
isCollection
in interface CNonElement
isCollection
in interface TypeUse
@Deprecated public CAdapter getAdapterUse()
CNonElement
getAdapterUse
in interface CNonElement
getAdapterUse
in interface TypeUse
@Deprecated public CNonElement getInfo()
CNonElement
getInfo
in interface CNonElement
getInfo
in interface TypeUse
public ID idUse()
TypeUse
ID is a property of a relationship. When a bean Foo has an ID property called 'bar' whose type is String, Foo isn't an ID, String isn't an ID, but this relationship is an ID (in the sense that Foo uses this String as an ID.)
The same thing can be said with IDREF. When Foo refers to Bar by means of IDREF, neither Foo nor Bar is IDREF.
That's why we have this method in TypeUse
.
public MimeType getExpectedMimeType()
TypeUse
TypeUse
can have an associated MIME type.getExpectedMimeType
in interface TypeUse
public Collection<CEnumConstant> getConstants()
EnumLeafInfo
getConstants
in interface EnumLeafInfo<NType,NClass>
public NonElement<NType,NClass> getBaseType()
EnumLeafInfo
For example, with the following enum class, this method
returns BuiltinLeafInfo
for Integer
.
&XmlEnum(Integer.class) enum Foo { &XmlEnumValue("1") ONE, &XmlEnumValue("2") TWO }
getBaseType
in interface EnumLeafInfo<NType,NClass>
public CCustomizations getCustomizations()
CCustomizable
getCustomizations
in interface CCustomizable
Plugin.getCustomizationURIs()
public Locatable getUpstream()
Locatable
Location
information.getUpstream
in interface Locatable
public Location getLocation()
Locatable
getLocation
in interface Locatable
Copyright © 2019 JBoss by Red Hat. All rights reserved.