com.sun.tools.xjc.model
Class CBuiltinLeafInfo

java.lang.Object
  extended by com.sun.xml.bind.v2.model.impl.BuiltinLeafInfoImpl<NType,NClass>
      extended by com.sun.tools.xjc.model.CBuiltinLeafInfo
All Implemented Interfaces:
CCustomizable, CNonElement, CTypeInfo, TypeUse, BuiltinLeafInfo<NType,NClass>, LeafInfo<NType,NClass>, MaybeElement<NType,NClass>, NonElement<NType,NClass>, TypeInfo<NType,NClass>, Location

public abstract class CBuiltinLeafInfo
extends BuiltinLeafInfoImpl<NType,NClass>
implements CNonElement

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.


Field Summary
static CBuiltinLeafInfo ANYTYPE
           
static CBuiltinLeafInfo BASE64_BYTE_ARRAY
           
static CBuiltinLeafInfo BIG_DECIMAL
           
static CBuiltinLeafInfo BIG_INTEGER
           
static CBuiltinLeafInfo BOOLEAN
           
static TypeUse BOOLEAN_ZERO_OR_ONE
          boolean restricted to 0 or 1.
static CBuiltinLeafInfo BYTE
           
static CBuiltinLeafInfo CALENDAR
           
static CBuiltinLeafInfo DATA_HANDLER
           
static CBuiltinLeafInfo DOUBLE
           
static CBuiltinLeafInfo DURATION
           
static CBuiltinLeafInfo FLOAT
           
static TypeUse HEXBIN_BYTE_ARRAY
           
static TypeUse ID
           
static TypeUse IDREF
          IDREF.
static CBuiltinLeafInfo IMAGE
           
static CBuiltinLeafInfo INT
           
static java.util.Map<NType,CBuiltinLeafInfo> LEAVES
          All built-in leaves.
static CBuiltinLeafInfo LONG
           
static TypeUse NORMALIZED_STRING
           
static CBuiltinLeafInfo QNAME
           
static CBuiltinLeafInfo SHORT
           
static CBuiltinLeafInfo STRING
           
static TypeUse STRING_LIST
          For all list of strings, such as NMTOKENS, ENTITIES.
static TypeUse TOKEN
           
static CBuiltinLeafInfo XML_SOURCE
           
 
Fields inherited from interface com.sun.xml.bind.v2.model.core.NonElement
ANYTYPE_NAME
 
Method Summary
 boolean canBeReferencedByIDREF()
          Deprecated. why are you calling a method whose return value is always known?
 CAdapter getAdapterUse()
          Deprecated. 
 javax.activation.MimeType getExpectedMimeType()
          CBuiltinLeafInfo never has a default associated MIME type.
 CNonElement getInfo()
          Deprecated. 
 Location getLocation()
           
 org.xml.sax.Locator getLocator()
          Gets the source location in the schema from which this model component is created.
 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.
 TypeT getType()
          A reference to the representation of the type.
 javax.xml.namespace.QName getTypeName()
          Gets the primary XML type ANYTYPE_NAME of the class.
 Locatable getUpstream()
           
 ID idUse()
          Whether the referenced type (individual item type in case of collection) is ID/IDREF.
 boolean isCollection()
          Deprecated. 
 boolean isSimpleType()
          Returns true if this NonElement maps to text in XML, without any attribute nor child elements.
 TypeUse makeAdapted(java.lang.Class<? extends javax.xml.bind.annotation.adapters.XmlAdapter> adapter, boolean copy)
          Creates a TypeUse that represents an adapted use of this CBuiltinLeafInfo.
 TypeUse makeCollection()
          Creates a TypeUse that represents a collection of this CBuiltinLeafInfo.
 TypeUse makeMimeTyped(javax.activation.MimeType mt)
          Creates a TypeUse that represents a MIME-type assocaited version of this CBuiltinLeafInfo.
 java.lang.String toString()
          Returns a human-readable string that represents this position.
 com.sun.codemodel.JType toType(Outline o, Aspect aspect)
          Gets the code model representation of this type.
 
Methods inherited from class com.sun.xml.bind.v2.model.impl.BuiltinLeafInfoImpl
asElement, createLeaves, getElementName, getTypeNames, isElement
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.sun.xml.bind.v2.model.core.NonElement
getTypeName, isSimpleType
 
Methods inherited from interface com.sun.tools.xjc.model.TypeUse
createConstant
 
Methods inherited from interface com.sun.xml.bind.v2.model.core.TypeInfo
canBeReferencedByIDREF, getType
 
Methods inherited from interface com.sun.tools.xjc.model.CCustomizable
getCustomizations
 
Methods inherited from interface com.sun.xml.bind.v2.model.core.BuiltinLeafInfo
getTypeName
 

Field Detail

LEAVES

public static final java.util.Map<NType,CBuiltinLeafInfo> LEAVES
All built-in leaves.


ANYTYPE

public static final CBuiltinLeafInfo ANYTYPE

STRING

public static final CBuiltinLeafInfo STRING

BOOLEAN

public static final CBuiltinLeafInfo BOOLEAN

INT

public static final CBuiltinLeafInfo INT

LONG

public static final CBuiltinLeafInfo LONG

BYTE

public static final CBuiltinLeafInfo BYTE

SHORT

public static final CBuiltinLeafInfo SHORT

FLOAT

public static final CBuiltinLeafInfo FLOAT

DOUBLE

public static final CBuiltinLeafInfo DOUBLE

QNAME

public static final CBuiltinLeafInfo QNAME

CALENDAR

public static final CBuiltinLeafInfo CALENDAR

DURATION

public static final CBuiltinLeafInfo DURATION

BIG_INTEGER

public static final CBuiltinLeafInfo BIG_INTEGER

BIG_DECIMAL

public static final CBuiltinLeafInfo BIG_DECIMAL

BASE64_BYTE_ARRAY

public static final CBuiltinLeafInfo BASE64_BYTE_ARRAY

DATA_HANDLER

public static final CBuiltinLeafInfo DATA_HANDLER

IMAGE

public static final CBuiltinLeafInfo IMAGE

XML_SOURCE

public static final CBuiltinLeafInfo XML_SOURCE

HEXBIN_BYTE_ARRAY

public static final TypeUse HEXBIN_BYTE_ARRAY

TOKEN

public static final TypeUse TOKEN

NORMALIZED_STRING

public static final TypeUse NORMALIZED_STRING

ID

public static final TypeUse ID

BOOLEAN_ZERO_OR_ONE

public static final TypeUse BOOLEAN_ZERO_OR_ONE
boolean restricted to 0 or 1.


IDREF

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.


STRING_LIST

public static final TypeUse STRING_LIST
For all list of strings, such as NMTOKENS, ENTITIES.

Method Detail

toType

public com.sun.codemodel.JType toType(Outline o,
                                      Aspect aspect)
Gets the code model representation of this type.

Specified by:
toType in interface CTypeInfo
See Also:
NType.toType(Outline, Aspect)

isCollection

@Deprecated
public final boolean isCollection()
Deprecated. 

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

Specified by:
isCollection in interface CNonElement
Specified by:
isCollection in interface TypeUse

getInfo

@Deprecated
public CNonElement getInfo()
Deprecated. 

Guaranteed to return this.

Specified by:
getInfo in interface CNonElement
Specified by:
getInfo in interface TypeUse

idUse

public ID idUse()
Description copied from interface: TypeUse
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 TypeUse.

Specified by:
idUse in interface TypeUse

getExpectedMimeType

public javax.activation.MimeType getExpectedMimeType()
CBuiltinLeafInfo never has a default associated MIME type.

Specified by:
getExpectedMimeType in interface TypeUse

getAdapterUse

@Deprecated
public final CAdapter getAdapterUse()
Deprecated. 

Description copied from interface: CNonElement
Guaranteed to return null.

Specified by:
getAdapterUse in interface CNonElement
Specified by:
getAdapterUse in interface TypeUse

getLocator

public org.xml.sax.Locator getLocator()
Description copied from interface: CCustomizable
Gets the source location in the schema from which this model component is created.

Specified by:
getLocator in interface CCustomizable
Returns:
never null.

getSchemaComponent

public final com.sun.xml.xsom.XSComponent getSchemaComponent()
Description copied from interface: CCustomizable
If this model object is built from XML Schema, this property returns a schema component from which the model is built.

Specified by:
getSchemaComponent in interface CCustomizable
Returns:
null if the model is built from sources other than XML Schema (such as DTD.)

makeCollection

public final TypeUse makeCollection()
Creates a TypeUse that represents a collection of this CBuiltinLeafInfo.


makeAdapted

public final TypeUse makeAdapted(java.lang.Class<? extends javax.xml.bind.annotation.adapters.XmlAdapter> adapter,
                                 boolean copy)
Creates a TypeUse that represents an adapted use of this CBuiltinLeafInfo.


makeMimeTyped

public final TypeUse makeMimeTyped(javax.activation.MimeType mt)
Creates a TypeUse that represents a MIME-type assocaited version of this CBuiltinLeafInfo.


getType

public TypeT getType()
A reference to the representation of the type.

Specified by:
getType in interface TypeInfo<TypeT,ClassDeclT>
Returns:
always non-null.

canBeReferencedByIDREF

public final boolean canBeReferencedByIDREF()
Deprecated. why are you calling a method whose return value is always known?

Leaf-type cannot be referenced from IDREF.

Specified by:
canBeReferencedByIDREF in interface TypeInfo<TypeT,ClassDeclT>

getTypeName

public javax.xml.namespace.QName getTypeName()
Description copied from interface: NonElement
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.

Specified by:
getTypeName in interface NonElement<TypeT,ClassDeclT>
Returns:
null if the object doesn't have an explicit type ANYTYPE_NAME (AKA anonymous.)

getUpstream

public Locatable getUpstream()

getLocation

public Location getLocation()

isSimpleType

public boolean isSimpleType()
Description copied from interface: NonElement
Returns true if this NonElement maps to text in XML, without any attribute nor child elements.

Specified by:
isSimpleType in interface NonElement<TypeT,ClassDeclT>

toString

public java.lang.String toString()
Description copied from interface: Location
Returns a human-readable string that represents this position.

Specified by:
toString in interface Location
Overrides:
toString in class java.lang.Object
Returns:
never null.