Class ItemType
- Direct Known Subclasses:
ItemType.BuiltInAtomicItemType
This class contains a number of static constant fields
referring to instances that represent simple item types, such as
item(), node(), and xs:anyAtomicType. These named types are currently
based on the definitions in XSD 1.0 and XML 1.0. They may be changed in a future version to be based
on a later version.
More complicated item types, especially those that are dependent on information in a schema,
are available using factory methods on the ItemTypeFactory object. The factory methods can
also be used to create variants of the types that use the rules given in the XML 1.1 and/or XSD 1.1
specifications. In addition the method ItemTypeFactory.parseItemType(java.lang.String) can be used to construct
ItemType objects from their representation in XPath syntax.
An ItemType can be used as a predicate in contexts where a predicate is required
to filter items, for example in Step.where(java.util.function.Predicate<? super T>).
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected static classItemType representing a built-in atomic type -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final ItemTypeItemType representing the type array(*), that is, any arraystatic final ItemTypeItemType representing the type xs:anyAtomicType, that is, any atomic valuestatic ItemTypeItemType representing the type function(*), that is, any functionstatic ItemTypeItemType representing the type item(), that is, any item at allstatic final ItemTypeItemType representing the type map(*), that is, any mapstatic final ItemTypeItemType representing the type node(), that is, any nodestatic final ItemTypeItemType representing the primitive type xs:anyURIstatic final ItemTypeItemType representing the ATTRIBUTE node() typestatic final ItemTypeItemType representing the primitive type xs:base64Binarystatic final ItemTypeItemType representing the primitive type xs:booleanstatic final ItemTypeItemType representing the built-in (but non-primitive) type xs:bytestatic final ItemTypeItemType representing the COMMENT node() typestatic final ItemTypeItemType representing the primitive type xs:datestatic final ItemTypeItemType representing the primitive type xs:dateTimestatic final ItemTypeItemType representing the built-in (but non-primitive) type xs:dateTimeStamp (introduced in XSD 1.1)static final ItemTypeItemType representing the built-in (but non-primitive) type xs:dayTimeDurationstatic final ItemTypeItemType representing the primitive type xs:decimalstatic final ItemTypeItemType representing the DOCUMENT node() typestatic final ItemTypeItemType representing the primitive type xs:doublestatic final ItemTypeItemType representing the primitive type xs:durationstatic final ItemTypeItemType representing the ELEMENT node() typestatic final ItemTypeItemType representing the built-in (but non-primitive) type xs:ENTITYstatic final ItemTypeItemType representing the type xs:error: a type with no instancesstatic final ItemTypeItemType representing the primitive type xs:floatstatic final ItemTypeItemType representing the primitive type xs:gDaystatic final ItemTypeItemType representing the primitive type xs:gMonthstatic final ItemTypeItemType representing the primitive type xs:gMonthDaystatic final ItemTypeItemType representing the primitive type xs:gYearstatic final ItemTypeItemType representing the primitive type xs:gYearMonthstatic final ItemTypeItemType representing the primitive type xs:hexBinarystatic final ItemTypeItemType representing the built-in (but non-primitive) type xs:IDstatic final ItemTypeItemType representing the built-in (but non-primitive) type xs:IDREFstatic final ItemTypeItemType representing the built-in (but non-primitive) type xs:intstatic final ItemTypeItemType representing the built-in (but non-primitive) type xs:integerstatic final ItemTypeItemType representing the built-in (but non-primitive) type xs:languagestatic final ItemTypeItemType representing the built-in (but non-primitive) type xs:longstatic final ItemTypeItemType representing the built-in (but non-primitive) type xs:Namestatic final ItemTypeItemType representing the NAMESPACE node() typestatic final ItemTypeItemType representing the built-in (but non-primitive) type xs:NCNamestatic final ItemTypeItemType representing the built-in (but non-primitive) type xs:negativeIntegerstatic final ItemTypeItemType representing the built-in (but non-primitive) type xs:NMTOKENstatic final ItemTypeItemType representing the built-in (but non-primitive) type xs:nonNegativeIntegerstatic final ItemTypeItemType representing the built-in (but non-primitive) type xs:nonPositiveIntegerstatic final ItemTypeItemType representing the built-in (but non-primitive) type xs:normalizedStringstatic final ItemTypeItemType representing the primitive type xs:NOTATIONstatic final ItemTypeItemType representing the built-in union type xs:numeric defined in XDM 3.1static final ItemTypeItemType representing the built-in (but non-primitive) type xs:positiveIntegerstatic final ItemTypeItemType representing the PROCESSING_INSTRUCTION node() typestatic final ItemTypeItemType representing the primitive type xs:QNamestatic final ItemTypeItemType representing the built-in (but non-primitive) type xs:shortstatic final ItemTypeItemType representing the primitive type xs:stringstatic final ItemTypeItemType representing the TEXT node() typestatic final ItemTypeItemType representing the primitive type xs:timestatic final ItemTypeItemType representing the built-in (but non-primitive) type xs:tokenprotected final ItemTypestatic final ItemTypeItemType representing the built-in (but non-primitive) type xs:unsignedBytestatic final ItemTypeItemType representing the built-in (but non-primitive) type xs:unsignedIntstatic final ItemTypeItemType representing the built-in (but non-primitive) type xs:unsignedLongstatic final ItemTypeItemType representing the built-in (but non-primitive) type xs:unsignedShortstatic final ItemTypeItemType representing the XPath-defined type xs:untypedAtomicstatic final ItemTypeItemType representing the built-in (but non-primitive) type xs:yearMonthDuration -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal booleanTest whether two ItemType objects represent the same typeGet the conversion rules implemented by this type.Get the name of the type, if it has oneMethod to get the underlying Saxon implementation objectfinal inthashCode()Get a hash code with semantics corresponding to the equals() methodabstract booleanDetermine whether this item type matches a given item.one()Combine the item type with the occurrence indicator "exactly one" to form a sequence type.Combine the item type with the occurrence indicator "one or more" (+) to form a sequence type.abstract booleanDetermine whether this ItemType subsumes another ItemType.booleanDetermine whether this item type matches a given item.toString()Get a string representation of the type.with(OccurrenceIndicator occurrenceIndicator) Combine an item type with an occurrence indicator to produce a SequenceType.Combine the item type with the occurrence indicator "zero or more" (*) to form a sequence type.Combine the item type with the occurrence indicator "zero or one" (?) to form a sequence type.
-
Field Details
-
underlyingType
-
ANY_ITEM
ItemType representing the type item(), that is, any item at all -
ANY_FUNCTION
ItemType representing the type function(*), that is, any function -
ANY_NODE
ItemType representing the type node(), that is, any node -
ATTRIBUTE_NODE
ItemType representing the ATTRIBUTE node() type -
COMMENT_NODE
ItemType representing the COMMENT node() type -
TEXT_NODE
ItemType representing the TEXT node() type -
ELEMENT_NODE
ItemType representing the ELEMENT node() type -
DOCUMENT_NODE
ItemType representing the DOCUMENT node() type -
NAMESPACE_NODE
ItemType representing the NAMESPACE node() type -
PROCESSING_INSTRUCTION_NODE
ItemType representing the PROCESSING_INSTRUCTION node() type -
ANY_MAP
ItemType representing the type map(*), that is, any map -
ANY_ARRAY
ItemType representing the type array(*), that is, any array -
ANY_ATOMIC_VALUE
ItemType representing the type xs:anyAtomicType, that is, any atomic value -
ERROR
ItemType representing the type xs:error: a type with no instances -
STRING
ItemType representing the primitive type xs:string -
BOOLEAN
ItemType representing the primitive type xs:boolean -
DURATION
ItemType representing the primitive type xs:duration -
DATE_TIME
ItemType representing the primitive type xs:dateTime -
DATE
ItemType representing the primitive type xs:date -
TIME
ItemType representing the primitive type xs:time -
G_YEAR_MONTH
ItemType representing the primitive type xs:gYearMonth -
G_MONTH
ItemType representing the primitive type xs:gMonth -
G_MONTH_DAY
ItemType representing the primitive type xs:gMonthDay -
G_YEAR
ItemType representing the primitive type xs:gYear -
G_DAY
ItemType representing the primitive type xs:gDay -
HEX_BINARY
ItemType representing the primitive type xs:hexBinary -
BASE64_BINARY
ItemType representing the primitive type xs:base64Binary -
ANY_URI
ItemType representing the primitive type xs:anyURI -
QNAME
ItemType representing the primitive type xs:QName -
NOTATION
ItemType representing the primitive type xs:NOTATION -
UNTYPED_ATOMIC
ItemType representing the XPath-defined type xs:untypedAtomic -
DECIMAL
ItemType representing the primitive type xs:decimal -
FLOAT
ItemType representing the primitive type xs:float -
DOUBLE
ItemType representing the primitive type xs:double -
INTEGER
ItemType representing the built-in (but non-primitive) type xs:integer -
NON_POSITIVE_INTEGER
ItemType representing the built-in (but non-primitive) type xs:nonPositiveInteger -
NEGATIVE_INTEGER
ItemType representing the built-in (but non-primitive) type xs:negativeInteger -
LONG
ItemType representing the built-in (but non-primitive) type xs:long -
INT
ItemType representing the built-in (but non-primitive) type xs:int -
SHORT
ItemType representing the built-in (but non-primitive) type xs:short -
BYTE
ItemType representing the built-in (but non-primitive) type xs:byte -
NON_NEGATIVE_INTEGER
ItemType representing the built-in (but non-primitive) type xs:nonNegativeInteger -
POSITIVE_INTEGER
ItemType representing the built-in (but non-primitive) type xs:positiveInteger -
UNSIGNED_LONG
ItemType representing the built-in (but non-primitive) type xs:unsignedLong -
UNSIGNED_INT
ItemType representing the built-in (but non-primitive) type xs:unsignedInt -
UNSIGNED_SHORT
ItemType representing the built-in (but non-primitive) type xs:unsignedShort -
UNSIGNED_BYTE
ItemType representing the built-in (but non-primitive) type xs:unsignedByte -
YEAR_MONTH_DURATION
ItemType representing the built-in (but non-primitive) type xs:yearMonthDuration -
DAY_TIME_DURATION
ItemType representing the built-in (but non-primitive) type xs:dayTimeDuration -
NORMALIZED_STRING
ItemType representing the built-in (but non-primitive) type xs:normalizedString -
TOKEN
ItemType representing the built-in (but non-primitive) type xs:token -
LANGUAGE
ItemType representing the built-in (but non-primitive) type xs:language -
NAME
ItemType representing the built-in (but non-primitive) type xs:Name -
NMTOKEN
ItemType representing the built-in (but non-primitive) type xs:NMTOKEN -
NCNAME
ItemType representing the built-in (but non-primitive) type xs:NCName -
ID
ItemType representing the built-in (but non-primitive) type xs:ID -
IDREF
ItemType representing the built-in (but non-primitive) type xs:IDREF -
ENTITY
ItemType representing the built-in (but non-primitive) type xs:ENTITY -
DATE_TIME_STAMP
ItemType representing the built-in (but non-primitive) type xs:dateTimeStamp (introduced in XSD 1.1) -
NUMERIC
ItemType representing the built-in union type xs:numeric defined in XDM 3.1
-
-
Constructor Details
-
ItemType
-
-
Method Details
-
with
Combine an item type with an occurrence indicator to produce a SequenceType. For exampleItemType.ANY_ITEM.with(OccurrenceIndicator.ONE_OR_MORE)returns the sequence typeitem()+.- Parameters:
occurrenceIndicator- the occurrence indicator to be used- Returns:
- the corresponding sequence type
-
one
Combine the item type with the occurrence indicator "exactly one" to form a sequence type.- Returns:
- the result of
with(OccurrenceIndicator.ONE)
-
oneOrMore
Combine the item type with the occurrence indicator "one or more" (+) to form a sequence type.- Returns:
- the result of
with(OccurrenceIndicator.ONE_OR_MORE)
-
zeroOrMore
Combine the item type with the occurrence indicator "zero or more" (*) to form a sequence type.- Returns:
- the result of
with(OccurrenceIndicator.ZERO_OR_MORE)
-
zeroOrOne
Combine the item type with the occurrence indicator "zero or one" (?) to form a sequence type.- Returns:
- the result of
with(OccurrenceIndicator.ZERO_OR_ONE)
-
getConversionRules
Get the conversion rules implemented by this type. The conversion rules reflect variations between different versions of the W3C specifications, for example XSD 1.1 allows "+INF" as a lexical representation of xs:double, while XSD 1.0 does not.- Returns:
- the conversion rules
-
test
Determine whether this item type matches a given item. This is a synonym of thematches(net.sf.saxon.s9api.XdmItem)method, provided so that anItemTypecan be used as aPredicate. -
matches
Determine whether this item type matches a given item.- Parameters:
item- the item to be tested against this item type- Returns:
- true if the item matches this item type, false if it does not match.
-
subsumes
Determine whether this ItemType subsumes another ItemType. Specifically,A.subsumes(B)is true if every value that matches the ItemType B also matches the ItemType A.- Parameters:
other- the other ItemType- Returns:
- true if this ItemType subsumes the other ItemType. This includes the case where A and B represent the same ItemType.
- Since:
- 9.1
-
getUnderlyingItemType
Method to get the underlying Saxon implementation objectThis gives access to Saxon methods that may change from one release to another.
- Returns:
- the underlying Saxon implementation object
-
getTypeName
Get the name of the type, if it has one- Returns:
- the name of the type, or null if it is either an anonymous schema-defined type, or an XDM-defined type such as node() or map().
- Since:
- 9.7
-
equals
Test whether two ItemType objects represent the same type -
hashCode
public final int hashCode()Get a hash code with semantics corresponding to the equals() method -
toString
Get a string representation of the type. This will be generally a string that conforms to the XPath ItemType production, for example a QName, or a construct such as "node()" or "map(*)".QNames are generally in EQName (
Q{uri}local) format, except that the prefixxs:is used for the XML Schema namespace.If the type is an anonymous schema type, the name of the nearest named base type will be given, preceded by the character "<".
In the case of a function item type, the returned string will be in parentheses (for example
(function() as xs:string)) so that an occurrence indicator can be added without ambiguity.
-