Class CBuiltinLeafInfo

java.lang.Object
com.sun.tools.xjc.model.CBuiltinLeafInfo
All Implemented Interfaces:
CCustomizable, CNonElement, CTypeInfo, TypeUse, com.sun.xml.bind.v2.model.annotation.Locatable, com.sun.xml.bind.v2.model.core.BuiltinLeafInfo<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>, com.sun.xml.bind.v2.runtime.Location

public abstract class CBuiltinLeafInfo extends Object implements CNonElement, com.sun.xml.bind.v2.model.core.BuiltinLeafInfo<NType,NClass>, com.sun.xml.bind.v2.model.core.LeafInfo<NType,NClass>, com.sun.xml.bind.v2.runtime.Location
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
  • Field Details

  • Method Details

    • toType

      public JType toType(Outline o, Aspect aspect)
      Gets the code model representation of this type.
      Specified by:
      toType in interface CTypeInfo
      See Also:
    • 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 com.sun.xml.bind.v2.model.core.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 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 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(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.
    • isElement

      public final boolean isElement()
      Deprecated.
      always return false at this level.
      Specified by:
      isElement in interface com.sun.xml.bind.v2.model.core.MaybeElement<NType,NClass>
    • getElementName

      public final QName getElementName()
      Deprecated.
      always return null at this level.
      Specified by:
      getElementName in interface com.sun.xml.bind.v2.model.core.MaybeElement<NType,NClass>
    • asElement

      public final com.sun.xml.bind.v2.model.core.Element<NType,NClass> asElement()
      Deprecated.
      always return null at this level.
      Specified by:
      asElement in interface com.sun.xml.bind.v2.model.core.MaybeElement<NType,NClass>
    • getType

      public NType getType()
      A reference to the representation of the type.
      Specified by:
      getType in interface com.sun.xml.bind.v2.model.core.TypeInfo<NType,NClass>
    • getTypeNames

      public final QName[] getTypeNames()
      Returns all the type names recognized by this bean info.
      Returns:
      do not modify the returned array.
    • 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 com.sun.xml.bind.v2.model.core.TypeInfo<NType,NClass>
    • getTypeName

      public QName getTypeName()
      Specified by:
      getTypeName in interface com.sun.xml.bind.v2.model.core.BuiltinLeafInfo<NType,NClass>
      Specified by:
      getTypeName in interface com.sun.xml.bind.v2.model.core.NonElement<NType,NClass>
    • getUpstream

      public com.sun.xml.bind.v2.model.annotation.Locatable getUpstream()
      Specified by:
      getUpstream in interface com.sun.xml.bind.v2.model.annotation.Locatable
    • getLocation

      public com.sun.xml.bind.v2.runtime.Location getLocation()
      Specified by:
      getLocation in interface com.sun.xml.bind.v2.model.annotation.Locatable
    • isSimpleType

      public boolean isSimpleType()
      Specified by:
      isSimpleType in interface com.sun.xml.bind.v2.model.core.NonElement<NType,NClass>