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

public abstract Class CBuiltinLeafInfo

extends Object
implements CNonElement, BuiltinLeafInfo<NType, NClass>, LeafInfo<NType, NClass>, Location
Class Inheritance
All Implemented Interfaces
org.glassfish.jaxb.core.v2.runtime.Location, org.glassfish.jaxb.core.v2.model.core.LeafInfo, org.glassfish.jaxb.core.v2.model.core.MaybeElement, org.glassfish.jaxb.core.v2.model.core.NonElement, org.glassfish.jaxb.core.v2.model.core.TypeInfo, org.glassfish.jaxb.core.v2.model.annotation.Locatable, org.glassfish.jaxb.core.v2.model.core.BuiltinLeafInfo, com.sun.tools.xjc.model.CNonElement, com.sun.tools.xjc.model.CTypeInfo, com.sun.tools.xjc.model.CCustomizable, com.sun.tools.xjc.model.TypeUse
Known Direct Subclasses
com.sun.tools.xjc.model.CBuiltinLeafInfo.Builtin
Imports
java.awt.*, java.math.BigDecimal, .BigInteger, java.util.HashMap, .Map, jakarta.activation.DataHandler, .MimeType, jakarta.xml.bind.DatatypeConverter, jakarta.xml.bind.annotation.XmlIDREF, jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter, .HexBinaryAdapter, .NormalizedStringAdapter, .XmlAdapter, .XmlJavaTypeAdapter, javax.xml.XMLConstants, javax.xml.datatype.Duration, .XMLGregorianCalendar, javax.xml.namespace.QName, javax.xml.transform.Source, com.sun.codemodel.JExpr, .JExpression, .JType, com.sun.tools.xjc.model.nav.NClass, .NType, .NavigatorImpl, com.sun.tools.xjc.outline.Aspect, .Outline, org.glassfish.jaxb.core.v2.model.annotation.Locatable, org.glassfish.jaxb.core.v2.model.core.BuiltinLeafInfo, .Element, .LeafInfo, .ID, org.glassfish.jaxb.core.v2.runtime.Location, com.sun.tools.xjc.runtime.ZeroOneBooleanAdapter, com.sun.tools.xjc.util.NamespaceContextAdapter, com.sun.xml.xsom.XSComponent, .XmlString, org.xml.sax.Locator

Encapsulates the default handling for leaf classes (which are bound to text in XML.) In particular this class knows how to convert the lexical value into the Java class according to this default rule.

This represents the spec-defined default handling for the Java type (getType().

For those Java classes (such as String or Boolean) where the spec designates a specific default handling, there are constants in this class (such as STRING or BOOLEAN.)

The generated type-safe enum classes are also a leaf class, and as such there are CEnumLeafInfo that represents it as CBuiltinLeafInfo.

This class represents the default handling, and therefore we can only have one instance per one NType. Handling of other XML Schema types (such as xs:token) are represented as a general TypeUse objects.

Author
Kohsuke Kawaguchi

Nested and Inner Type Summary

Modifier and TypeClass and Description
private abstract static class
CBuiltinLeafInfo.Builtin

CBuiltinLeafInfo for Java classes that have the spec defined built-in binding semantics.

private static class

Field Summary

Modifier and TypeField and Description
public static final CBuiltinLeafInfo
public static final CBuiltinLeafInfo
public static final CBuiltinLeafInfo
public static final CBuiltinLeafInfo
public static final CBuiltinLeafInfo
public static final TypeUse
BOOLEAN_ZERO_OR_ONE

boolean restricted to 0 or 1.

public static final CBuiltinLeafInfo
public static final CBuiltinLeafInfo
public static final CBuiltinLeafInfo
public static final CBuiltinLeafInfo
public static final CBuiltinLeafInfo
public static final CBuiltinLeafInfo
public static final TypeUse
private final ID
public static final TypeUse
public static final TypeUse
IDREF

IDREF.

public static final CBuiltinLeafInfo
public static final CBuiltinLeafInfo
public static final Map<NType, CBuiltinLeafInfo>
LEAVES

All built-in leaves.

public static final CBuiltinLeafInfo
public static final TypeUse
public static final CBuiltinLeafInfo
public static final CBuiltinLeafInfo
public static final CBuiltinLeafInfo
public static final TypeUse
STRING_LIST

For all list of strings, such as NMTOKENS, ENTITIES.

public static final TypeUse
private final NType
private final QName
typeName

Can be null for anonymous types.

private final QName[]
public static final CBuiltinLeafInfo

Constructor Summary

AccessConstructor and Description
private
CBuiltinLeafInfo(NType typeToken, ID id, QName... typeNames)

Method Summary

Modifier and TypeMethod and Description
public final Element<NType, NClass>
asElement()

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

Deprecated always return null at this level.

Returns the Element aspect of this ClassInfo.

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.

public final CAdapter
getAdapterUse()

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

Deprecated

Guaranteed to return null.

public final QName
getElementName()

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

Deprecated always return null at this level.

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.

never has a default 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.

Gets the source location in the schema from which this model component is created.

public final 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.

A reference to the representation of the type.

public QName
public final QName[]

Returns:

do not modify the returned array.
getTypeNames
()

Returns all the type names recognized by this bean info.

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 final boolean
isCollection()

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

Deprecated

Since represents a default binding, it is never a collection.

public final boolean
isElement()

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

Deprecated always return false at this level.

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 final TypeUse
makeAdapted(Class<? extends XmlAdapter<ValueType, BoundType>> adapter, boolean copy)

Creates a TypeUse that represents an adapted use of this .

public final TypeUse
makeCollection()

Creates a TypeUse that represents a collection of this .

public final TypeUse
makeMimeTyped(MimeType mt)

Creates a TypeUse that represents a MIME-type assocaited version of this .

public JType
toType(Outline o, Aspect aspect)

Implements com.sun.tools.xjc.model.CTypeInfo.toType.

Gets the code model representation of this type.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

ANYTYPEback to summary
public static final CBuiltinLeafInfo ANYTYPE
BASE64_BYTE_ARRAYback to summary
public static final CBuiltinLeafInfo BASE64_BYTE_ARRAY
BIG_DECIMALback to summary
public static final CBuiltinLeafInfo BIG_DECIMAL
BIG_INTEGERback to summary
public static final CBuiltinLeafInfo BIG_INTEGER
BOOLEANback to summary
public static final CBuiltinLeafInfo BOOLEAN
BOOLEAN_ZERO_OR_ONEback to summary
public static final TypeUse BOOLEAN_ZERO_OR_ONE

boolean restricted to 0 or 1.

BYTEback to summary
public static final CBuiltinLeafInfo BYTE
CALENDARback to summary
public static final CBuiltinLeafInfo CALENDAR
DATA_HANDLERback to summary
public static final CBuiltinLeafInfo DATA_HANDLER
DOUBLEback to summary
public static final CBuiltinLeafInfo DOUBLE
DURATIONback to summary
public static final CBuiltinLeafInfo DURATION
FLOATback to summary
public static final CBuiltinLeafInfo FLOAT
HEXBIN_BYTE_ARRAYback to summary
public static final TypeUse HEXBIN_BYTE_ARRAY
idback to summary
private final ID id
IDback to summary
public static final TypeUse ID
IDREFback to summary
public static final TypeUse IDREF

IDREF. IDREF is has a whitespace normalization semantics of token, but we don't want XmlJavaTypeAdapter and XmlIDREF to interact.

IMAGEback to summary
public static final CBuiltinLeafInfo IMAGE
INTback to summary
public static final CBuiltinLeafInfo INT
LEAVESback to summary
public static final Map<NType, CBuiltinLeafInfo> LEAVES

All built-in leaves.

LONGback to summary
public static final CBuiltinLeafInfo LONG
NORMALIZED_STRINGback to summary
public static final TypeUse NORMALIZED_STRING
QNAMEback to summary
public static final CBuiltinLeafInfo QNAME
SHORTback to summary
public static final CBuiltinLeafInfo SHORT
STRINGback to summary
public static final CBuiltinLeafInfo STRING
STRING_LISTback to summary
public static final TypeUse STRING_LIST

For all list of strings, such as NMTOKENS, ENTITIES.

TOKENback to summary
public static final TypeUse TOKEN
typeback to summary
private final NType type
typeNameback to summary
private final QName typeName

Can be null for anonymous types.

typeNamesback to summary
private final QName[] typeNames
XML_SOURCEback to summary
public static final CBuiltinLeafInfo XML_SOURCE

Constructor Detail

CBuiltinLeafInfoback to summary
private CBuiltinLeafInfo(NType typeToken, ID id, QName... typeNames)

Method Detail

asElementback to summary
public final 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.

Deprecated

always return null at this level.

Returns the Element aspect of this ClassInfo.

Annotations
@Deprecated
@Override
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
@Deprecated
@Override
getAdapterUseback to summary
public final 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
getElementNameback to summary
public final QName getElementName()

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

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

Deprecated

always return null at this level.

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

Annotations
@Deprecated
@Override
getExpectedMimeTypeback to summary
public MimeType getExpectedMimeType()

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

never has a default associated MIME type.

Annotations
@Override
getInfoback to summary
public CNonElement getInfo()

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

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

Gets the source location in the schema from which this model component is created.

Annotations
@Override
getSchemaComponentback to summary
public final 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.

A reference to the representation of the type.

Annotations
@Override
getTypeNameback to summary
public QName getTypeName()

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

Doc from org.glassfish.jaxb.core.v2.model.core.BuiltinLeafInfo.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.

This method returns the 'primary' type name of this built-in leaf, which should be used when values of this type are marshalled.

Annotations
@Override
getTypeNamesback to summary
public final QName[] getTypeNames()

Returns all the type names recognized by this bean info.

Returns:QName[]

do not modify the returned array.

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
isCollectionback to summary
public final boolean isCollection()

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

Deprecated

Since represents a default binding, it is never a collection.

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

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

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

Deprecated

always return false at this level.

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
@Deprecated
@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
makeAdaptedback to summary
public final TypeUse makeAdapted(Class<? extends XmlAdapter<ValueType, BoundType>> adapter, boolean copy)

Creates a TypeUse that represents an adapted use of this .

makeCollectionback to summary
public final TypeUse makeCollection()

Creates a TypeUse that represents a collection of this .

makeMimeTypedback to summary
public final TypeUse makeMimeTyped(MimeType mt)

Creates a TypeUse that represents a MIME-type assocaited version of this .

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

Implements com.sun.tools.xjc.model.CTypeInfo.toType.

Gets the code model representation of this type.

Annotations
@Override
com.sun.tools.xjc.model back to summary

private abstract Class CBuiltinLeafInfo.Builtin

extends CBuiltinLeafInfo
Class Inheritance
Known Direct Subclasses
com.sun.tools.xjc.model.CBuiltinLeafInfo.NoConstantBuiltin

CBuiltinLeafInfo for Java classes that have the spec defined built-in binding semantics.

Field Summary

Inherited from com.sun.tools.xjc.model.CBuiltinLeafInfo:
ANYTYPEBASE64_BYTE_ARRAYBIG_DECIMALBIG_INTEGERBOOLEANBOOLEAN_ZERO_OR_ONEBYTECALENDARDATA_HANDLERDOUBLEDURATIONFLOATHEXBIN_BYTE_ARRAYIDIDREFIMAGEINTLEAVESLONGNORMALIZED_STRINGQNAMESHORTSTRINGSTRING_LISTTOKENXML_SOURCE

Constructor Summary

AccessConstructor and Description
protected
Builtin(Class<?> c, String typeName)

protected
Builtin(Class<?> c, String typeName, ID id)

Method Summary

Modifier and TypeMethod and Description
public CCustomizations
getCustomizations()

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

No vendor customization in the built-in classes.

Inherited from com.sun.tools.xjc.model.CBuiltinLeafInfo:
asElementcanBeReferencedByIDREFgetAdapterUsegetElementNamegetExpectedMimeTypegetInfogetLocationgetLocatorgetSchemaComponentgetTypegetTypeNamegetTypeNamesgetUpstreamidUseisCollectionisElementisSimpleTypemakeAdaptedmakeCollectionmakeMimeTypedtoType

Constructor Detail

Builtinback to summary
protected Builtin(Class<?> c, String typeName)
Builtinback to summary
protected Builtin(Class<?> c, String typeName, ID id)

Method Detail

getCustomizationsback to summary
public CCustomizations getCustomizations()

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

No vendor customization in the built-in classes.

Annotations
@Override
com.sun.tools.xjc.model back to summary

private final Class CBuiltinLeafInfo.NoConstantBuiltin

extends Builtin
Class Inheritance

Constructor Summary

AccessConstructor and Description
public
NoConstantBuiltin(Class<?> c, String typeName)

Method Summary

Modifier and TypeMethod and Description
public JExpression
createConstant(Outline outline, XmlString lexical)

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

Creates a constant for the given lexical value.

Inherited from com.sun.tools.xjc.model.CBuiltinLeafInfo.Builtin:
getCustomizations

Constructor Detail

NoConstantBuiltinback to summary
public NoConstantBuiltin(Class<?> c, String typeName)

Method Detail

createConstantback to summary
public JExpression createConstant(Outline outline, XmlString lexical)

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