Package org.basex.query.value.type
Interface Type
public interface Type
XQuery types.
- Author:
- BaseX Team 2005-21, BSD License, Christian Gruen
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic enumType IDs for client/server communication. -
Method Summary
Modifier and TypeMethodDescriptionatomic()Returns the atomic type.cast(Object value, QueryContext qc, StaticContext sc, InputInfo ii) Casts the specified Java value to this type.cast(Item item, QueryContext qc, StaticContext sc, InputInfo ii) Casts the specified item to this type.castString(String value, QueryContext qc, StaticContext sc, InputInfo ii) Casts the specified string to this type.booleanChecks if this type is equal to the given one.id()Returns a type id to differentiate all types.booleaninstanceOf(Type type) Checks if the current type is an instance of the specified type.Computes the intersection between this type and the given one, i.e.booleanisNumber()Checks if items with this type are numbers.booleanChecks if items with this type are numbers or untyped.booleanChecks if items of this type are sortable.booleanChecks if items of this type are strings or untyped.booleanChecks if items with this type are untyped.booleanChecks if the type is namespace-sensitive.default booleanChecks if this is one of the specified types.default TypeReturns the given type, or the type of the specified expression if it is more specific.default SeqTypeseqType()Returns a sequence type with a single number of occurrence.Internal function for creating a sequence type with the specified occurrence indicator.toString()Computes the union between this type and the given one, i.e.
-
Method Details
-
cast
Casts the specified item to this type.- Parameters:
item- item to be convertedqc- query contextsc- static contextii- input info- Returns:
- cast value
- Throws:
QueryException- query exception
-
cast
Casts the specified Java value to this type.- Parameters:
value- Java valueqc- query contextsc- static contextii- input info- Returns:
- cast value
- Throws:
QueryException- query exception
-
castString
Value castString(String value, QueryContext qc, StaticContext sc, InputInfo ii) throws QueryException Casts the specified string to this type.- Parameters:
value- string objectqc- query contextsc- static contextii- input info- Returns:
- cast value
- Throws:
QueryException- query exception
-
seqType
Returns a sequence type with a single number of occurrence.- Returns:
- sequence type
-
seqType
Internal function for creating a sequence type with the specified occurrence indicator.- Parameters:
occ- occurrence indicator- Returns:
- sequence type
- See Also:
-
oneOf
Checks if this is one of the specified types.- Parameters:
types- types- Returns:
- result of check
-
eq
Checks if this type is equal to the given one.- Parameters:
type- other type- Returns:
trueif both types are equal,falseotherwise
-
instanceOf
Checks if the current type is an instance of the specified type.- Parameters:
type- type to be checked- Returns:
- result of check
-
union
Computes the union between this type and the given one, i.e. the least common ancestor of both types in the type hierarchy.- Parameters:
type- other type- Returns:
- union type
-
intersect
Computes the intersection between this type and the given one, i.e. the least specific type that is sub-type of both types. If no such type exists,nullis returned.- Parameters:
type- other type- Returns:
- intersection type or
null
-
isNumber
boolean isNumber()Checks if items with this type are numbers.- Returns:
- result of check
-
isUntyped
boolean isUntyped()Checks if items with this type are untyped.- Returns:
- result of check
-
isNumberOrUntyped
boolean isNumberOrUntyped()Checks if items with this type are numbers or untyped.- Returns:
- result of check
-
isStringOrUntyped
boolean isStringOrUntyped()Checks if items of this type are strings or untyped. Returns if this item is untyped or a string.- Returns:
- result of check
-
isSortable
boolean isSortable()Checks if items of this type are sortable.- Returns:
- result of check
-
atomic
AtomType atomic()Returns the atomic type.- Returns:
- atomic type (can be
null, e.g. for function types)
-
id
Type.ID id()Returns a type id to differentiate all types.- Returns:
- id
-
nsSensitive
boolean nsSensitive()Checks if the type is namespace-sensitive.- Returns:
- result of check
-
refine
Returns the given type, or the type of the specified expression if it is more specific.- Parameters:
expr- expression- Returns:
- node type
-
toString
String toString()
-