Top Description Fields Constructors Methods
com.sun.tools.xjc.model

public final Class CEnumLeafInfo

extends Object
implements EnumLeafInfo<NType, NClass>, NClass, CNonElement
Class Inheritance
All Implemented Interfaces
com.sun.tools.xjc.model.CNonElement, com.sun.tools.xjc.model.CTypeInfo, com.sun.tools.xjc.model.CCustomizable, org.glassfish.jaxb.core.v2.model.core.TypeInfo, org.glassfish.jaxb.core.v2.model.annotation.Locatable, com.sun.tools.xjc.model.TypeUse, org.glassfish.jaxb.core.v2.model.core.NonElement, com.sun.tools.xjc.model.nav.NClass, com.sun.tools.xjc.model.nav.NType, org.glassfish.jaxb.core.v2.model.core.EnumLeafInfo, org.glassfish.jaxb.core.v2.model.core.LeafInfo, org.glassfish.jaxb.core.v2.model.core.MaybeElement
Imports
java.util.Collection, jakarta.activation.MimeType, javax.xml.namespace.QName, com.sun.codemodel.JClass, .JExpression, com.sun.tools.xjc.model.nav.NClass, .NType, com.sun.tools.xjc.outline.Aspect, .Outline, org.glassfish.jaxb.core.v2.model.annotation.Locatable, org.glassfish.jaxb.core.v2.model.core.EnumLeafInfo, .ID, .NonElement, .Element, org.glassfish.jaxb.core.v2.runtime.Location, com.sun.xml.xsom.XSComponent, .XmlString, org.xml.sax.Locator

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

Modifier and TypeField and Description
public final CNonElement
base

Represents the underlying type of this enumeration and its conversion.

private final CCustomizations
public String
public final Collection<CEnumConstant>
members

List of enum members.

public final Model
model

The Model object to which this bean belongs.

public final CClassInfoParent
parent

The parent into which the enum class should be generated.

public final String
shortName

Short name of the generated type-safe enum.

private final XSComponent
private final Locator
private final QName

Constructor Summary

AccessConstructor and Description
public
CEnumLeafInfo(Model model, QName typeName, CClassInfoParent container, String shortName, CNonElement base, Collection<CEnumConstant> _members, XSComponent source, CCustomizations customizations, Locator _sourceLocator)

Method Summary

Modifier and TypeMethod and Description
public Element<NType, NClass>
public boolean
canBeReferencedByIDREF()

Implements org.glassfish.jaxb.core.v2.model.core.TypeInfo.canBeReferencedByIDREF.

Deprecated why are you calling the method whose return value is known?

True if this type is a valid target from a property annotated with XmlIDREF.

public JExpression
createConstant(Outline outline, XmlString literal)

Implements com.sun.tools.xjc.model.TypeUse.createConstant.

Creates a constant for the given lexical value.

public String
fullName()

Implements com.sun.tools.xjc.model.nav.NType.fullName.

Human readable name of this type.

public CAdapter
getAdapterUse()

Implements com.sun.tools.xjc.model.CNonElement.getAdapterUse.

Deprecated

Guaranteed to return null.

public NonElement<NType, NClass>
getBaseType()

Implements org.glassfish.jaxb.core.v2.model.core.EnumLeafInfo.getBaseType.

Returns the base type of the enumeration.

public NClass
getClazz()

Implements org.glassfish.jaxb.core.v2.model.core.EnumLeafInfo.getClazz.

The same as getType() but an is guaranteed to represent an enum declaration, which is a kind of a class declaration.

public Collection<CEnumConstant>
getConstants()

Implements org.glassfish.jaxb.core.v2.model.core.EnumLeafInfo.getConstants.

Returns the read-only list of enumeration constants.

public CCustomizations
getCustomizations()

Implements com.sun.tools.xjc.model.CCustomizable.getCustomizations.

Gets the list of customizations attached to this model component.

public QName
getElementName()

Implements org.glassfish.jaxb.core.v2.model.core.MaybeElement.getElementName.

Gets the element name of the class, if the class is bound to an element.

public MimeType
getExpectedMimeType()

Implements com.sun.tools.xjc.model.TypeUse.getExpectedMimeType.

A can have an associated MIME type.

public CNonElement
getInfo()

Implements com.sun.tools.xjc.model.CNonElement.getInfo.

Deprecated

Guaranteed to return this.

public Location
getLocation()

Implements org.glassfish.jaxb.core.v2.model.annotation.Locatable.getLocation.

Gets the location object that this object points to.

public Locator
getLocator()

Implements com.sun.tools.xjc.model.CCustomizable.getLocator.

Source line information that points to the place where this type-safe enum is defined.

public XSComponent
getSchemaComponent()

Implements com.sun.tools.xjc.model.CCustomizable.getSchemaComponent.

If this model object is built from XML Schema, this property returns a schema component from which the model is built.

public NType
getType()

Implements org.glassfish.jaxb.core.v2.model.core.TypeInfo.getType.

Gets the underlying Java type that object represents.

public QName
getTypeName()

Implements org.glassfish.jaxb.core.v2.model.core.NonElement.getTypeName.

Gets the primary XML type ANYTYPE_NAME of the class.

public Locatable
public ID
idUse()

Implements com.sun.tools.xjc.model.TypeUse.idUse.

Whether the referenced type (individual item type in case of collection) is ID/IDREF.

public boolean
public boolean
isBoxedType()

Implements com.sun.tools.xjc.model.nav.NType.isBoxedType.

Returns true iff this type represents a class that has a unboxed form.

public boolean
isCollection()

Implements com.sun.tools.xjc.model.CNonElement.isCollection.

Deprecated

Guaranteed to return false.

public boolean
isElement()

Implements org.glassfish.jaxb.core.v2.model.core.MaybeElement.isElement.

If the class is bound to an element, return true.

public boolean
public boolean
isSimpleType()

Implements org.glassfish.jaxb.core.v2.model.core.NonElement.isSimpleType.

Returns true if this maps to text in XML, without any attribute nor child elements.

public boolean

Returns:

true if the generated enum class should have the value field.
needsValueField
()

The spec says the value field in the enum class will be generated only under certain circumstances.

public JClass
toType(Outline o, Aspect aspect)

Implements com.sun.tools.xjc.model.nav.NClass.toType, com.sun.tools.xjc.model.CTypeInfo.toType.

Returns the representation of this type in code model.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

baseback to summary
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.

customizationsback to summary
private final CCustomizations customizations
javadocback to summary
public String javadoc
membersback to summary
public final Collection<CEnumConstant> members

List of enum members.

modelback to summary
public final Model model

The Model object to which this bean belongs.

parentback to summary
public final CClassInfoParent parent

The parent into which the enum class should be generated.

shortNameback to summary
public final String shortName

Short name of the generated type-safe enum.

sourceback to summary
private final XSComponent source
sourceLocatorback to summary
private final Locator sourceLocator
See Also
getLocator()
typeNameback to summary
private final QName typeName

Constructor Detail

CEnumLeafInfoback to summary
public CEnumLeafInfo(Model model, QName typeName, CClassInfoParent container, String shortName, CNonElement base, Collection<CEnumConstant> _members, XSComponent source, CCustomizations customizations, Locator _sourceLocator)

Method Detail

asElementback to summary
public Element<NType, NClass> asElement()

Implements org.glassfish.jaxb.core.v2.model.core.MaybeElement.asElement.

Doc from org.glassfish.jaxb.core.v2.model.core.MaybeElement.asElement.

Returns the Element aspect of this ClassInfo.

Annotations
@Override
canBeReferencedByIDREFback to summary
public boolean canBeReferencedByIDREF()

Implements org.glassfish.jaxb.core.v2.model.core.TypeInfo.canBeReferencedByIDREF.

Doc from org.glassfish.jaxb.core.v2.model.core.TypeInfo.canBeReferencedByIDREF.

Deprecated

why are you calling the method whose return value is known?

True if this type is a valid target from a property annotated with XmlIDREF.

Annotations
@Deprecated
@Override
createConstantback to summary
public JExpression createConstant(Outline outline, XmlString literal)

Implements com.sun.tools.xjc.model.TypeUse.createConstant.

Doc from com.sun.tools.xjc.model.TypeUse.createConstant.

Creates 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.

Annotations
@Override
fullNameback to summary
public String fullName()

Implements com.sun.tools.xjc.model.nav.NType.fullName.

Doc from com.sun.tools.xjc.model.nav.NType.fullName.

Human readable name of this type.

Annotations
@Override
getAdapterUseback to summary
public CAdapter getAdapterUse()

Implements com.sun.tools.xjc.model.CNonElement.getAdapterUse.

Doc from com.sun.tools.xjc.model.CNonElement.getAdapterUse.

Deprecated

Guaranteed to return null.

Annotations
@Deprecated
@Override
getBaseTypeback to summary
public NonElement<NType, NClass> getBaseType()

Implements org.glassfish.jaxb.core.v2.model.core.EnumLeafInfo.getBaseType.

Doc from org.glassfish.jaxb.core.v2.model.core.EnumLeafInfo.getBaseType.

Returns the base type of the enumeration.

For example, with the following enum class, this method returns BuiltinLeafInfo for Integer.

&XmlEnum(Integer.class)
enum Foo {
  &XmlEnumValue("1")
  ONE,
  &XmlEnumValue("2")
  TWO
}
Annotations
@Override
getClazzback to summary
public NClass getClazz()

Implements org.glassfish.jaxb.core.v2.model.core.EnumLeafInfo.getClazz.

Doc from org.glassfish.jaxb.core.v2.model.core.EnumLeafInfo.getClazz.

The same as getType() but an is guaranteed to represent an enum declaration, which is a kind of a class declaration.

Annotations
@Override
getConstantsback to summary
public Collection<CEnumConstant> getConstants()

Implements org.glassfish.jaxb.core.v2.model.core.EnumLeafInfo.getConstants.

Doc from org.glassfish.jaxb.core.v2.model.core.EnumLeafInfo.getConstants.

Returns the read-only list of enumeration constants.

Annotations
@Override
getCustomizationsback to summary
public CCustomizations getCustomizations()

Implements com.sun.tools.xjc.model.CCustomizable.getCustomizations.

Doc from com.sun.tools.xjc.model.CCustomizable.getCustomizations.

Gets the list of customizations attached to this model component.

Annotations
@Override
getElementNameback to summary
public QName getElementName()

Implements org.glassfish.jaxb.core.v2.model.core.MaybeElement.getElementName.

Doc from org.glassfish.jaxb.core.v2.model.core.MaybeElement.getElementName.

Gets the element name of the class, if the class is bound to an element.

Annotations
@Override
getExpectedMimeTypeback to summary
public MimeType getExpectedMimeType()

Implements com.sun.tools.xjc.model.TypeUse.getExpectedMimeType.

Doc from com.sun.tools.xjc.model.TypeUse.getExpectedMimeType.

A can have an associated MIME type.

Annotations
@Override
getInfoback to summary
public CNonElement getInfo()

Implements com.sun.tools.xjc.model.CNonElement.getInfo.

Doc from com.sun.tools.xjc.model.CNonElement.getInfo.

Deprecated

Guaranteed to return this.

Annotations
@Deprecated
@Override
getLocationback to summary
public Location getLocation()

Implements org.glassfish.jaxb.core.v2.model.annotation.Locatable.getLocation.

Doc from org.glassfish.jaxb.core.v2.model.annotation.Locatable.getLocation.

Gets the location object that this object points to. This operation could be inefficient and costly.

Annotations
@Override
getLocatorback to summary
public Locator getLocator()

Implements com.sun.tools.xjc.model.CCustomizable.getLocator.

Source line information that points to the place where this type-safe enum is defined. Used to report error messages.

Annotations
@Override
getSchemaComponentback to summary
public XSComponent getSchemaComponent()

Implements com.sun.tools.xjc.model.CCustomizable.getSchemaComponent.

Doc from com.sun.tools.xjc.model.CCustomizable.getSchemaComponent.

If this model object is built from XML Schema, this property returns a schema component from which the model is built.

Annotations
@Override
getTypeback to summary
public NType getType()

Implements org.glassfish.jaxb.core.v2.model.core.TypeInfo.getType.

Doc from org.glassfish.jaxb.core.v2.model.core.TypeInfo.getType.

Gets the underlying Java type that object represents.

Annotations
@Override
getTypeNameback to summary
public QName getTypeName()

Implements org.glassfish.jaxb.core.v2.model.core.NonElement.getTypeName.

Doc from org.glassfish.jaxb.core.v2.model.core.NonElement.getTypeName.

Gets the primary XML type ANYTYPE_NAME of the class.

A Java type can be mapped to multiple XML types, but one of them is considered "primary" and used when we generate a schema.

Annotations
@Override
getUpstreamback to summary
public Locatable getUpstream()

Implements org.glassfish.jaxb.core.v2.model.annotation.Locatable.getUpstream.

Doc from org.glassfish.jaxb.core.v2.model.annotation.Locatable.getUpstream.

Gets the upstream Location information.

Annotations
@Override
idUseback to summary
public ID idUse()

Implements com.sun.tools.xjc.model.TypeUse.idUse.

Doc from com.sun.tools.xjc.model.TypeUse.idUse.

Whether 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 .

Annotations
@Override
isAbstractback to summary
public boolean isAbstract()

Implements com.sun.tools.xjc.model.nav.NClass.isAbstract.

Annotations
@Override
isBoxedTypeback to summary
public boolean isBoxedType()

Implements com.sun.tools.xjc.model.nav.NType.isBoxedType.

Doc from com.sun.tools.xjc.model.nav.NType.isBoxedType.

Returns true iff this type represents a class that has a unboxed form. For example, for String this is false, but for Integer this is true.

Annotations
@Override
isCollectionback to summary
public boolean isCollection()

Implements com.sun.tools.xjc.model.CNonElement.isCollection.

Doc from com.sun.tools.xjc.model.CNonElement.isCollection.

Deprecated

Guaranteed to return false.

Annotations
@Deprecated
@Override
isElementback to summary
public boolean isElement()

Implements org.glassfish.jaxb.core.v2.model.core.MaybeElement.isElement.

Doc from org.glassfish.jaxb.core.v2.model.core.MaybeElement.isElement.

If the class is bound to an element, return true.

Note that when this is true, the class is bound to both an element and a type.

Annotations
@Override
isPrimitiveback to summary
public boolean isPrimitive()
isSimpleTypeback to summary
public boolean isSimpleType()

Implements org.glassfish.jaxb.core.v2.model.core.NonElement.isSimpleType.

Doc from org.glassfish.jaxb.core.v2.model.core.NonElement.isSimpleType.

Returns true if this maps to text in XML, without any attribute nor child elements.

Annotations
@Override
needsValueFieldback to summary
public boolean needsValueField()

The spec says the value field in the enum class will be generated only under certain circumstances.

Returns:boolean

true if the generated enum class should have the value field.

toTypeback to summary
public JClass toType(Outline o, Aspect aspect)

Implements com.sun.tools.xjc.model.nav.NClass.toType, com.sun.tools.xjc.model.CTypeInfo.toType.

Doc from com.sun.tools.xjc.model.nav.NType.toType.

Returns 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.

Annotations
@Override