Top Description Fields Constructors Methods
org.glassfish.jaxb.runtime.v2.model.impl

pack-priv Class EnumLeafInfoImpl<T, C, F, M>

extends TypeInfoImpl<T, C, F, M>
implements EnumLeafInfo<T, C>, Element<T, C>, Iterable<EnumConstantImpl<T, C, F, M>>
Class Inheritance
All Implemented Interfaces
java.lang.Iterable, org.glassfish.jaxb.core.v2.model.core.Element, org.glassfish.jaxb.core.v2.model.core.TypeInfo, org.glassfish.jaxb.core.v2.model.annotation.Locatable, org.glassfish.jaxb.core.v2.model.core.EnumLeafInfo, org.glassfish.jaxb.core.v2.model.core.LeafInfo, org.glassfish.jaxb.core.v2.model.core.MaybeElement, org.glassfish.jaxb.core.v2.model.core.NonElement
Known Direct Subclasses
org.glassfish.jaxb.runtime.v2.model.impl.RuntimeEnumLeafInfoImpl
Imports
org.glassfish.jaxb.core.v2.model.annotation.Locatable, org.glassfish.jaxb.core.v2.model.core.*, org.glassfish.jaxb.core.v2.runtime.Location, jakarta.xml.bind.annotation.XmlEnum, .XmlEnumValue, .XmlRootElement, .XmlSchemaType, javax.xml.namespace.QName, java.util.Collection, .Iterator

EnumLeafInfo implementation.
Author
Kohsuke Kawaguchi

Field Summary

Modifier and TypeField and Description
pack-priv NonElement<T, C>
pack-priv final C
clazz

The enum class whose information this object represents.

private QName
elementName

If this enum is also bound to an element, that tag name.

private EnumConstantImpl<T, C, F, M>
firstConstant

All the EnumConstantImpls are linked in this list.

protected boolean
tokenStringType

Used to recognize token vs string.

private final T
private final QName
typeName

Can be null for anonymous types.

Inherited from org.glassfish.jaxb.runtime.v2.model.impl.TypeInfoImpl:
builderowner

Constructor Summary

AccessConstructor and Description
public
EnumLeafInfoImpl(ModelBuilder<T, C, F, M> builder, Locatable upstream, C clazz, T
clazz and type should both point to the enum class that this EnumLeafInfo represents. Because of the type parameterization we have to take them separately.
type
)

Method Summary

Modifier and TypeMethod and Description
public Element<T, C>
protected void
calcConstants()

Build EnumConstants and discover/report any error in it.

public final boolean
canBeReferencedByIDREF()

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

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

Leaf-type cannot be referenced from IDREF.

protected EnumConstantImpl<T, C, F, M>
createEnumConstant(String name, String literal, F constant, EnumConstantImpl<T, C, F, M> last)

public NonElement<T, C>
getBaseType()

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

Returns the base type of the enumeration.

public C
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 Iterable<? extends EnumConstantImpl<T, C, F, M>>
getConstants()

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

Returns the read-only list of enumeration constants.

public QName
public Location
getLocation()

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

Gets the location object that this object points to.

public ClassInfo<T, C>
getScope()

Implements org.glassfish.jaxb.core.v2.model.core.Element.getScope.

Deprecated you shouldn't be invoking this method on ClassInfoImpl.

When a bean binds to an element, it's always through XmlRootElement, so this method always return null.

public Element<T, C>
getSubstitutionHead()

Implements org.glassfish.jaxb.core.v2.model.core.Element.getSubstitutionHead.

Deprecated if you are invoking this method directly, there's something wrong.

No substitution.

public T
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 boolean
isElement()

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

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

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
isToken()

Returns: true if enum is restriction/extension from xs:token type, otherwise false

public Iterator<EnumConstantImpl<T, C, F, M>>
iterator()

Implements java.lang.Iterable.iterator.

Returns an iterator over elements of type T.

Inherited from org.glassfish.jaxb.runtime.v2.model.impl.TypeInfoImpl:
getUpstreamnavparseElementNameparseTypeNameparseTypeNamereader

Field Detail

baseTypeback to summary
pack-priv NonElement<T, C> baseType
clazzback to summary
pack-priv final C clazz

The enum class whose information this object represents.

elementNameback to summary
private QName elementName

If this enum is also bound to an element, that tag name. Or else null.

firstConstantback to summary
private EnumConstantImpl<T, C, F, M> firstConstant

All the EnumConstantImpls are linked in this list.

tokenStringTypeback to summary
protected boolean tokenStringType

Used to recognize token vs string.

typeback to summary
private final T type
typeNameback to summary
private final QName typeName

Can be null for anonymous types.

Constructor Detail

EnumLeafInfoImplback to summary
public EnumLeafInfoImpl(ModelBuilder<T, C, F, M> builder, Locatable upstream, C clazz, T type)
Parameters
type:T

clazz and type should both point to the enum class that this EnumLeafInfo represents. Because of the type parameterization we have to take them separately.

Method Detail

asElementback to summary
public Element<T, C> 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
calcConstantsback to summary
protected void calcConstants()

Build EnumConstants and discover/report any error in it.

canBeReferencedByIDREFback to summary
public final boolean canBeReferencedByIDREF()

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

Deprecated

why are you calling a method whose return value is always known?

Leaf-type cannot be referenced from IDREF.

Annotations
@Override
@Deprecated
createEnumConstantback to summary
protected EnumConstantImpl<T, C, F, M> createEnumConstant(String name, String literal, F constant, EnumConstantImpl<T, C, F, M> last)
getBaseTypeback to summary
public NonElement<T, C> 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 C 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 Iterable<? extends EnumConstantImpl<T, C, F, M>> 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
getElementNameback to summary
public QName getElementName()

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

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

Gets the element name of the class.

Annotations
@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
getScopeback to summary
public ClassInfo<T, C> getScope()

Implements org.glassfish.jaxb.core.v2.model.core.Element.getScope.

Deprecated

you shouldn't be invoking this method on ClassInfoImpl.

When a bean binds to an element, it's always through XmlRootElement, so this method always return null.

Annotations
@Override
@Deprecated
getSubstitutionHeadback to summary
public Element<T, C> getSubstitutionHead()

Implements org.glassfish.jaxb.core.v2.model.core.Element.getSubstitutionHead.

Deprecated

if you are invoking this method directly, there's something wrong.

No substitution.

Annotations
@Override
@Deprecated
getTypeback to summary
public T 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
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
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
isTokenback to summary
public boolean isToken()
Returns:boolean

true if enum is restriction/extension from xs:token type, otherwise false

iteratorback to summary
public Iterator<EnumConstantImpl<T, C, F, M>> iterator()

Implements java.lang.Iterable.iterator.

Doc from java.lang.Iterable.iterator.

Returns an iterator over elements of type T.

Annotations
@Override