Class CBuiltinLeafInfo

  • All Implemented Interfaces:
    CCustomizable, CNonElement, CTypeInfo, TypeUse, Locatable, BuiltinLeafInfo<com.sun.tools.xjc.model.nav.NType,​com.sun.tools.xjc.model.nav.NClass>, LeafInfo<com.sun.tools.xjc.model.nav.NType,​com.sun.tools.xjc.model.nav.NClass>, MaybeElement<com.sun.tools.xjc.model.nav.NType,​com.sun.tools.xjc.model.nav.NClass>, NonElement<com.sun.tools.xjc.model.nav.NType,​com.sun.tools.xjc.model.nav.NClass>, TypeInfo<com.sun.tools.xjc.model.nav.NType,​com.sun.tools.xjc.model.nav.NClass>, Location

    public abstract class CBuiltinLeafInfo
    extends Object
    implements CNonElement, BuiltinLeafInfo<com.sun.tools.xjc.model.nav.NType,​com.sun.tools.xjc.model.nav.NClass>, LeafInfo<com.sun.tools.xjc.model.nav.NType,​com.sun.tools.xjc.model.nav.NClass>, 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
    • Method Detail

      • toType

        public 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, com.sun.tools.xjc.outline.Aspect)
      • 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
      • 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.)
      • 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 MaybeElement<com.sun.tools.xjc.model.nav.NType,​com.sun.tools.xjc.model.nav.NClass>
      • getElementName

        public final QName getElementName()
        Deprecated.
        always return null at this level.
        Specified by:
        getElementName in interface MaybeElement<com.sun.tools.xjc.model.nav.NType,​com.sun.tools.xjc.model.nav.NClass>
      • asElement

        public final Element<com.sun.tools.xjc.model.nav.NType,​com.sun.tools.xjc.model.nav.NClass> asElement()
        Deprecated.
        always return null at this level.
        Specified by:
        asElement in interface MaybeElement<com.sun.tools.xjc.model.nav.NType,​com.sun.tools.xjc.model.nav.NClass>
      • getType

        public com.sun.tools.xjc.model.nav.NType getType()
        A reference to the representation of the type.
        Specified by:
        getType in interface TypeInfo<com.sun.tools.xjc.model.nav.NType,​com.sun.tools.xjc.model.nav.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 TypeInfo<com.sun.tools.xjc.model.nav.NType,​com.sun.tools.xjc.model.nav.NClass>
      • getTypeName

        public QName getTypeName()
        Specified by:
        getTypeName in interface BuiltinLeafInfo<com.sun.tools.xjc.model.nav.NType,​com.sun.tools.xjc.model.nav.NClass>
        Specified by:
        getTypeName in interface NonElement<com.sun.tools.xjc.model.nav.NType,​com.sun.tools.xjc.model.nav.NClass>
      • isSimpleType

        public boolean isSimpleType()
        Specified by:
        isSimpleType in interface NonElement<com.sun.tools.xjc.model.nav.NType,​com.sun.tools.xjc.model.nav.NClass>