Class TLcdXMLSchemaTypeIdentifier

java.lang.Object
com.luciad.format.xml.bind.schema.TLcdXMLSchemaTypeIdentifier

public final class TLcdXMLSchemaTypeIdentifier extends Object
An identifier for XML schema types that allows referring to both global and anonymous types.
The identifier is a path composed of a number of steps. Each step has an axis, specifying the semantic meaning of the step (e.g. an attribute or element), and an associated value (e.g. the name of the attribute or element).

Examples

  • A global type:
    
       <xsd:simpleType name="GlobalType">
           <xsd:restriction>
               <xsd:simpleType>
                   <xsd:list itemType="xsd:string"/>
               </xsd:simpleType>
           </xsd:restriction>
       </xsd:simpleType>
     
    The schema type identifier for the global type can be built as follows:
    
       TLcdXMLSchemaTypeIdentifier.newBuilder()
         .step(GLOBAL_TYPE, new QName(ns, "GlobalType"))
         .build();
     
    The schema type identifier of the anonymous base type of the global type can be built as follows:
    
       TLcdXMLSchemaTypeIdentifier.newBuilder()
         .step(GLOBAL_TYPE, new QName(ns, "GlobalType"))
         .step(ANONYMOUS_BASE_TYPE, null)
         .build();
     
  • The anonymous type of a global attribute:
    
       <xsd:attribute name="GlobalAttribute">
           <xsd:simpleType>
               <xsd:restriction base="xsd:string"/>
           </xsd:simpleType>
       </xsd:attribute>
     
    The schema type identifier can be built as follows:
    
       TLcdXMLSchemaTypeIdentifier.newBuilder()
         .step(ANONYMOUS_ATTRIBUTE_TYPE, new QName(ns, "GlobalAttribute"))
         .build();
     
  • The anonymous type of a local element within another local element:
    
      <xsd:complexType name="GlobalType">
           <xsd:sequence>
               <xsd:element name="FirstLocalElement">
                   <xsd:complexType>
                       <xsd:sequence>
                           <xsd:element name="SecondLocalElement">
                               <xsd:complexType>
                                   <xsd:simpleContent>
                                       <xsd:extension base="xsd:string">
                                       </xsd:extension>
                                   </xsd:simpleContent>
                               </xsd:complexType>
                           </xsd:element>
                       </xsd:sequence>
                   </xsd:complexType>
               </xsd:element>
           </xsd:sequence>
       </xsd:complexType>
     
    The schema type identifier can be built as follows:
    
       TLcdXMLSchemaTypeIdentifier.newBuilder()
         .step(GLOBAL_TYPE, new QName(ns, "GlobalType"))
         .step(ANONYMOUS_ELEMENT_TYPE, new QName(ns, "FirstLocalElement"))
         .step(ANONYMOUS_ELEMENT_TYPE, new QName(ns, "SecondLocalElement"))
         .build();
     
  • An anonymous type of a local attribute in a global element:
    
       <xsd:element name="GlobalElement">
           <xsd:complexType>
               <xsd:attribute name="LocalAttribute">
                   <xsd:simpleType>
                       <xsd:restriction base="xsd:string"/>
                   </xsd:simpleType>
               </xsd:attribute>
           </xsd:complexType>
       </xsd:element>
     
    The schema type identifier can be built as follows:
    
       TLcdXMLSchemaTypeIdentifier.newBuilder()
         .step(ANONYMOUS_ELEMENT_TYPE, new QName(ns, "GlobalElement"))
         .step(ANONYMOUS_ATTRIBUTE_TYPE, new QName(ns, "LocalAttribute"))
         .build();
     
Since:
9.0
  • Method Details

    • newBuilder

      public static TLcdXMLSchemaTypeIdentifier.Builder newBuilder()
      Creates an empty builder without any steps.
      Returns:
      an empty builder without any steps
    • newBuilder

      public static TLcdXMLSchemaTypeIdentifier.Builder newBuilder(TLcdXMLSchemaTypeIdentifier aParentTypeId)
      Creates a new builder pre-configured with the steps of the given identifier.
      Parameters:
      aParentTypeId - the identifier whose steps to build upon
      Returns:
      a new pre-configured builder
    • newInstance

      public static TLcdXMLSchemaTypeIdentifier newInstance(QName aTypeName, QName[] aElementNames, QName aAttributeName)
      Returns an instance of a TLcdXMLSchemaTypeIdentifier representing the specified XML schema type.
      It is recommended to create a Builder instead.
      Parameters:
      aTypeName - a global type name
      aElementNames - a stack of element names
      aAttributeName - an attribute name
      Returns:
      an instance of a TLcdXMLSchemaTypeIdentifier representing the specified XML schema type.
      Throws:
      NullPointerException - if all arguments are null.
    • newInstance

      public static TLcdXMLSchemaTypeIdentifier newInstance(QName aTypeName, QName aGroupName, QName[] aElementNames, QName aAttributeName, int aUnionIndex)
      Returns an instance of a TLcdXMLSchemaTypeIdentifier representing the specified XML schema type.
      It is recommended to create a Builder instead.
      Parameters:
      aTypeName - a global type name
      aGroupName - a global group name
      aElementNames - a stack of element names
      aAttributeName - an attribute name
      aUnionIndex - the index of the type in the list of locally defined types within a union
      Returns:
      an instance of a TLcdXMLSchemaTypeIdentifier representing the specified XML schema type.
      Throws:
      NullPointerException - if all arguments are null.
    • newGlobalTypeInstance

      public static TLcdXMLSchemaTypeIdentifier newGlobalTypeInstance(QName aTypeName)
      Returns an instance of a TLcdXMLSchemaTypeIdentifier representing the specified XML global schema type.
      Parameters:
      aTypeName - a global type name
      Returns:
      an instance of a TLcdXMLSchemaTypeIdentifier representing the specified XML schema type.
      Throws:
      NullPointerException - if all arguments are null.
    • getTypeName

      public final QName getTypeName()
      Returns the global type name of this XML schema type identifier, or null if this identifier does not have a global type name.
      Returns:
      the global type name of this XML schema type identifier, or null if this identifier does not have a global type name.
    • getGroupName

      public final QName getGroupName()
      Returns the global group name of this XML schema type identifier, or null if this identifier does not have a global group name.
      Returns:
      the global group name of this XML schema type identifier, or null if this identifier does not have a global group name.
    • getElementNames

      public final QName[] getElementNames()
      Returns the element name stack of this XML schema type identifier, or null if this identifier does not have an element name stack.
      Returns:
      the element name stack of this XML schema type identifier, or null if this identifier does not have an element name stack.
    • getAttributeName

      public QName getAttributeName()
      Returns the attribute name of this XML schema type identifier, or null if this identifier does not have an attribute name.
      Returns:
      the attribute name of this XML schema type identifier, or null if this identifier does not have an attribute name.
    • isGlobal

      public boolean isGlobal()
      Returns true if the type identified by this type identifier is global, false otherwise.
      Returns:
      true if the type identified by this type identifier is global, false otherwise.
    • isAnonymousListItemType

      public boolean isAnonymousListItemType()
      Returns true if the type identified by this type identifier is an anonymous list type, false otherwise.
      Returns:
      true if the last step axis is an TLcdXMLSchemaTypeIdentifier.StepAxis.ANONYMOUS_LIST_ITEM_TYPE
    • getStepAxes

      public TLcdXMLSchemaTypeIdentifier.StepAxis[] getStepAxes()
      Returns all the step axes.
      Returns:
      all step axes.
    • getStepIdentifiers

      public Object[] getStepIdentifiers()
      Returns all the step identifiers associated with the step axes.
      Returns:
      all step identifiers
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Returns a general description of this schema type identifier, containing the global type name, element name stack and attribute name of this type identifier.

      The exact details of the representation are unspecified and are subject to change.

      Overrides:
      toString in class Object
    • getUnionIndex

      public int getUnionIndex()
      Returns -1 in case the identifier does not refer to an anonymous type that is defined within a union type. Otherwise, returns the index of this type in the list of anonymous types defined in the type identified by a type identifier that is equal to this identifier but with a union index equal to -1.
      Returns:
      the union index for this type