Class CEnumLeafInfo
- java.lang.Object
-
- com.sun.tools.xjc.model.CEnumLeafInfo
-
- All Implemented Interfaces:
CCustomizable,CNonElement,CTypeInfo,NClass,NType,TypeUse,com.sun.xml.bind.v2.model.annotation.Locatable,com.sun.xml.bind.v2.model.core.EnumLeafInfo<NType,NClass>,com.sun.xml.bind.v2.model.core.LeafInfo<NType,NClass>,com.sun.xml.bind.v2.model.core.MaybeElement<NType,NClass>,com.sun.xml.bind.v2.model.core.NonElement<NType,NClass>,com.sun.xml.bind.v2.model.core.TypeInfo<NType,NClass>
public final class CEnumLeafInfo extends Object implements com.sun.xml.bind.v2.model.core.EnumLeafInfo<NType,NClass>, NClass, CNonElement
Transducer that converts a string into an "enumeration class." The structure of the generated class needs to precisely follow the JAXB spec.- Author:
- Kohsuke KAWAGUCHI
-
-
Field Summary
Fields Modifier and Type Field Description CNonElementbaseRepresents the underlying type of this enumeration and its conversion.StringjavadocCollection<CEnumConstant>membersList of enum members.ModelmodelTheModelobject to which this bean belongs.CClassInfoParentparentThe parent into which the enum class should be generated.StringshortNameShort name of the generated type-safe enum.
-
Constructor Summary
Constructors Constructor Description CEnumLeafInfo(Model model, QName typeName, CClassInfoParent container, String shortName, CNonElement base, Collection<CEnumConstant> _members, XSComponent source, CCustomizations customizations, Locator _sourceLocator)
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description com.sun.xml.bind.v2.model.core.Element<NType,NClass>asElement()booleancanBeReferencedByIDREF()Deprecated.why are you calling the method whose return value is known?JExpressioncreateConstant(Outline outline, XmlString literal)Creates a constant for the given lexical value.StringfullName()Human readable name of this type.CAdaptergetAdapterUse()Deprecated.com.sun.xml.bind.v2.model.core.NonElement<NType,NClass>getBaseType()NClassgetClazz()Collection<CEnumConstant>getConstants()CCustomizationsgetCustomizations()Gets the list of customizations attached to this model component.QNamegetElementName()MimeTypegetExpectedMimeType()ATypeUsecan have an associated MIME type.CNonElementgetInfo()Deprecated.com.sun.xml.bind.v2.runtime.LocationgetLocation()LocatorgetLocator()Source line information that points to the place where this type-safe enum is defined.XSComponentgetSchemaComponent()If this model object is built from XML Schema, this property returns a schema component from which the model is built.NTypegetType()QNamegetTypeName()com.sun.xml.bind.v2.model.annotation.LocatablegetUpstream()com.sun.xml.bind.v2.model.core.IDidUse()Whether the referenced type (individual item type in case of collection) is ID/IDREF.booleanisAbstract()booleanisBoxedType()Returns true iff this type represents a class that has a unboxed form.booleanisCollection()Deprecated.booleanisElement()booleanisPrimitive()booleanisSimpleType()booleanneedsValueField()The spec says the value field in the enum class will be generated only under certain circumstances.JClasstoType(Outline o, Aspect aspect)Returns the representation of this type in code model.
-
-
-
Field Detail
-
parent
public final CClassInfoParent parent
The parent into which the enum class should be generated.
-
shortName
public final String shortName
Short name of the generated type-safe enum.
-
base
public final CNonElement base
Represents the underlying type of this enumeration and its conversion.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.
-
members
public final Collection<CEnumConstant> members
List of enum members.
-
javadoc
public String javadoc
-
-
Constructor Detail
-
CEnumLeafInfo
public CEnumLeafInfo(Model model, QName typeName, CClassInfoParent container, String shortName, CNonElement base, Collection<CEnumConstant> _members, XSComponent source, CCustomizations customizations, Locator _sourceLocator)
-
-
Method Detail
-
getLocator
public Locator getLocator()
Source line information that points to the place where this type-safe enum is defined. Used to report error messages.- Specified by:
getLocatorin interfaceCCustomizable- Returns:
- never null.
-
getTypeName
public QName getTypeName()
-
getType
public NType getType()
-
canBeReferencedByIDREF
public boolean canBeReferencedByIDREF()
Deprecated.why are you calling the method whose return value is known?
-
isElement
public boolean isElement()
-
getElementName
public QName getElementName()
-
getClazz
public NClass getClazz()
-
getSchemaComponent
public XSComponent getSchemaComponent()
Description copied from interface:CCustomizableIf this model object is built from XML Schema, this property returns a schema component from which the model is built.- Specified by:
getSchemaComponentin interfaceCCustomizable- Returns:
- null if the model is built from sources other than XML Schema (such as DTD.)
-
toType
public JClass toType(Outline o, Aspect aspect)
Description copied from interface:NTypeReturns the representation of this type in code model.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.
- Specified by:
toTypein interfaceCTypeInfo- Specified by:
toTypein interfaceNClass- Specified by:
toTypein interfaceNTypeaspect- IfAspect.IMPLEMENTATION, this method returns the implementation specific class that this type represents. IfAspect.EXPOSED, this method returns the publicly exposed type that this type represents. For ordinary classes, the aspect parameter is meaningless.- See Also:
NType.toType(Outline, com.sun.tools.xjc.outline.Aspect)
-
isAbstract
public boolean isAbstract()
- Specified by:
isAbstractin interfaceNClass
-
isBoxedType
public boolean isBoxedType()
Description copied from interface:NTypeReturns true iff this type represents a class that has a unboxed form. For example, forStringthis is false, but forIntegerthis is true.- Specified by:
isBoxedTypein interfaceNType
-
fullName
public String fullName()
Description copied from interface:NTypeHuman readable name of this type.
-
isPrimitive
public boolean isPrimitive()
-
isSimpleType
public boolean isSimpleType()
-
needsValueField
public boolean needsValueField()
The spec says the value field in the enum class will be generated only under certain circumstances.- Returns:
- true if the generated enum class should have the value field.
-
createConstant
public JExpression createConstant(Outline outline, XmlString literal)
Description copied from interface:TypeUseCreates a constant for the given lexical value.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.
- Specified by:
createConstantin interfaceTypeUse- Returns:
- null
if the constant cannot be created for this
TypeUse(such as when it's a collection)
-
isCollection
@Deprecated public boolean isCollection()
Deprecated.Description copied from interface:CNonElementGuaranteed to return false.- Specified by:
isCollectionin interfaceCNonElement- Specified by:
isCollectionin interfaceTypeUse
-
getAdapterUse
@Deprecated public CAdapter getAdapterUse()
Deprecated.Description copied from interface:CNonElementGuaranteed to return null.- Specified by:
getAdapterUsein interfaceCNonElement- Specified by:
getAdapterUsein interfaceTypeUse
-
getInfo
@Deprecated public CNonElement getInfo()
Deprecated.Description copied from interface:CNonElementGuaranteed to return this.- Specified by:
getInfoin interfaceCNonElement- Specified by:
getInfoin interfaceTypeUse
-
idUse
public com.sun.xml.bind.v2.model.core.ID idUse()
Description copied from interface:TypeUseWhether the referenced type (individual item type in case of collection) is ID/IDREF.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.
-
getExpectedMimeType
public MimeType getExpectedMimeType()
Description copied from interface:TypeUseATypeUsecan have an associated MIME type.- Specified by:
getExpectedMimeTypein interfaceTypeUse
-
getConstants
public Collection<CEnumConstant> getConstants()
-
getCustomizations
public CCustomizations getCustomizations()
Description copied from interface:CCustomizableGets the list of customizations attached to this model component.- Specified by:
getCustomizationsin interfaceCCustomizable- Returns:
- can be an empty list but never be null. The returned list is read-only. Do not modify.
- See Also:
Plugin.getCustomizationURIs()
-
getUpstream
public com.sun.xml.bind.v2.model.annotation.Locatable getUpstream()
- Specified by:
getUpstreamin interfacecom.sun.xml.bind.v2.model.annotation.Locatable
-
getLocation
public com.sun.xml.bind.v2.runtime.Location getLocation()
- Specified by:
getLocationin interfacecom.sun.xml.bind.v2.model.annotation.Locatable
-
-