Class TLcdXMLSchemaTypeIdentifier
java.lang.Object
com.luciad.format.xml.bind.schema.TLcdXMLSchemaTypeIdentifier
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
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:
The schema type identifier for the global type can be built as follows:<xsd:simpleType name="GlobalType"> <xsd:restriction> <xsd:simpleType> <xsd:list itemType="xsd:string"/> </xsd:simpleType> </xsd:restriction> </xsd:simpleType>
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")) .build();
TLcdXMLSchemaTypeIdentifier.newBuilder() .step(GLOBAL_TYPE, new QName(ns, "GlobalType")) .step(ANONYMOUS_BASE_TYPE, null) .build();
-
The anonymous type of a global attribute:
The schema type identifier can be built as follows:<xsd:attribute name="GlobalAttribute"> <xsd:simpleType> <xsd:restriction base="xsd:string"/> </xsd:simpleType> </xsd:attribute>
TLcdXMLSchemaTypeIdentifier.newBuilder() .step(ANONYMOUS_ATTRIBUTE_TYPE, new QName(ns, "GlobalAttribute")) .build();
-
The anonymous type of a local element within another local element:
The schema type identifier can be built as follows:<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>
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:
The schema type identifier can be built as follows:<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>
TLcdXMLSchemaTypeIdentifier.newBuilder() .step(ANONYMOUS_ELEMENT_TYPE, new QName(ns, "GlobalElement")) .step(ANONYMOUS_ATTRIBUTE_TYPE, new QName(ns, "LocalAttribute")) .build();
- Since:
- 9.0
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
Builder to easily add steps to create schema type identifiers.static enum
The semantic meaning of a schema type identifier step (e.g. an attribute, an element group, a union). -
Method Summary
Modifier and TypeMethodDescriptionboolean
Returns the attribute name of this XML schema type identifier, ornull
if this identifier does not have an attribute name.final QName[]
Returns the element name stack of this XML schema type identifier, ornull
if this identifier does not have an element name stack.final QName
Returns the global group name of this XML schema type identifier, ornull
if this identifier does not have a global group name.Returns all the step axes.Object[]
Returns all the step identifiers associated with the step axes.final QName
Returns the global type name of this XML schema type identifier, ornull
if this identifier does not have a global type name.int
Returns-1
in case the identifier does not refer to an anonymous type that is defined within a union type.int
hashCode()
boolean
Returnstrue
if the type identified by this type identifier is an anonymous list type,false
otherwise.boolean
isGlobal()
Returnstrue
if the type identified by this type identifier is global,false
otherwise.Creates an empty builder without any steps.newBuilder
(TLcdXMLSchemaTypeIdentifier aParentTypeId) Creates a new builder pre-configured with the steps of the given identifier.static TLcdXMLSchemaTypeIdentifier
newGlobalTypeInstance
(QName aTypeName) Returns an instance of aTLcdXMLSchemaTypeIdentifier
representing the specified XML global schema type.static TLcdXMLSchemaTypeIdentifier
newInstance
(QName aTypeName, QName[] aElementNames, QName aAttributeName) Returns an instance of aTLcdXMLSchemaTypeIdentifier
representing the specified XML schema type.static TLcdXMLSchemaTypeIdentifier
newInstance
(QName aTypeName, QName aGroupName, QName[] aElementNames, QName aAttributeName, int aUnionIndex) Returns an instance of aTLcdXMLSchemaTypeIdentifier
representing the specified XML schema type.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.
-
Method Details
-
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 aTLcdXMLSchemaTypeIdentifier
representing the specified XML schema type.
It is recommended to create aBuilder
instead.- Parameters:
aTypeName
- a global type nameaElementNames
- a stack of element namesaAttributeName
- an attribute name- Returns:
- an instance of a
TLcdXMLSchemaTypeIdentifier
representing the specified XML schema type. - Throws:
NullPointerException
- if all arguments arenull
.
-
newInstance
public static TLcdXMLSchemaTypeIdentifier newInstance(QName aTypeName, QName aGroupName, QName[] aElementNames, QName aAttributeName, int aUnionIndex) Returns an instance of aTLcdXMLSchemaTypeIdentifier
representing the specified XML schema type.
It is recommended to create aBuilder
instead.- Parameters:
aTypeName
- a global type nameaGroupName
- a global group nameaElementNames
- a stack of element namesaAttributeName
- an attribute nameaUnionIndex
- 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 arenull
.
-
newGlobalTypeInstance
Returns an instance of aTLcdXMLSchemaTypeIdentifier
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 arenull
.
-
getTypeName
Returns the global type name of this XML schema type identifier, ornull
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
Returns the global group name of this XML schema type identifier, ornull
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
Returns the element name stack of this XML schema type identifier, ornull
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
Returns the attribute name of this XML schema type identifier, ornull
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()Returnstrue
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()Returnstrue
if the type identified by this type identifier is an anonymous list type,false
otherwise.- Returns:
true
if the last step axis is anTLcdXMLSchemaTypeIdentifier.StepAxis.ANONYMOUS_LIST_ITEM_TYPE
-
getStepAxes
Returns all the step axes.- Returns:
- all step axes.
-
getStepIdentifiers
Returns all the step identifiers associated with the step axes.- Returns:
- all step identifiers
-
equals
-
hashCode
public int hashCode() -
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. -
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
-