public class TupleItemType extends AnyFunctionType implements TupleType
ItemType.WithSequenceTypeCache
ANY_FUNCTION
Constructor and Description |
---|
TupleItemType(java.util.List<java.lang.String> names,
java.util.List<SequenceType> types) |
TupleItemType(java.util.List<java.lang.String> names,
java.util.List<SequenceType> types,
java.util.Set<java.lang.String> optionalFields,
boolean extensible) |
Modifier and Type | Method and Description |
---|---|
boolean |
equals(java.lang.Object other)
Test whether this function type equals another function type
|
java.util.Optional<java.lang.String> |
explainMismatch(Item item,
TypeHierarchy th)
Get extra diagnostic information about why a supplied item does not conform to this
item type, if available.
|
java.lang.String |
generateJavaScriptItemTypeTest(ItemType knownToBe,
int targetVersion)
Generate Javascript code to test whether an item conforms to this item type
|
SequenceType[] |
getArgumentTypes()
Get the argument types of this map, viewed as a function
|
int |
getArity()
Get the arity (number of arguments) of this function type
|
java.lang.Iterable<java.lang.String> |
getFieldNames()
Get the names of all the fields
|
SequenceType |
getFieldType(java.lang.String field)
Get the type of a given field
|
Genre |
getGenre()
Determine the Genre (top-level classification) of this type
|
SequenceType |
getResultType()
Get the result type of this tuple type, viewed as a function
|
int |
hashCode()
Returns a hash code value for the object.
|
boolean |
isArrayType()
Ask whether this function item type is an array type.
|
boolean |
isExtensible()
Ask whether the tuple type is extensible, that is, whether fields other than those named are permitted
|
boolean |
isMapType()
Ask whether this function item type is a map type.
|
boolean |
isOptional(java.lang.String field)
Ask whether a particular field is optional (that is, allowed to be absent from the map)
|
Expression |
makeFunctionSequenceCoercer(Expression exp,
RoleDiagnostic role)
Create an expression whose effect is to apply function coercion to coerce a function from this type to another type
|
boolean |
matches(Item item,
TypeHierarchy th)
Test whether a given item conforms to this type
|
int |
relationship(FunctionItemType other,
TypeHierarchy th)
Determine the relationship of one function item type to another
|
java.lang.String |
toExportString()
Return a string representation of this ItemType suitable for use in stylesheet
export files.
|
java.lang.String |
toString()
Produce a representation of this type name for use in error messages.
|
generateJavaScriptItemTypeAcceptor, getAlphaCode, getAnnotationAssertions, getAtomizedItemType, getInstance, getPrimitiveItemType, getPrimitiveType, getUType, isAtomicType, isAtomizable, isPlainType
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
getAnnotationAssertions
generateJavaScriptItemTypeAcceptor, getAlphaCode, getAtomizedItemType, getPrimitiveItemType, getPrimitiveType, getUType, isAtomicType, isAtomizable, isPlainType, isTrueItemType
public TupleItemType(java.util.List<java.lang.String> names, java.util.List<SequenceType> types)
public TupleItemType(java.util.List<java.lang.String> names, java.util.List<SequenceType> types, java.util.Set<java.lang.String> optionalFields, boolean extensible)
public Genre getGenre()
getGenre
in interface FunctionItemType
getGenre
in interface ItemType
Genre.MAP
public boolean isMapType()
isMapType
in interface FunctionItemType
isMapType
in class AnyFunctionType
public boolean isArrayType()
isArrayType
in interface FunctionItemType
isArrayType
in class AnyFunctionType
public java.lang.Iterable<java.lang.String> getFieldNames()
getFieldNames
in interface TupleType
public SequenceType getFieldType(java.lang.String field)
getFieldType
in interface TupleType
field
- the name of the fieldpublic boolean isOptional(java.lang.String field)
TupleType
isOptional
in interface TupleType
field
- the name of the fieldpublic boolean isExtensible()
isExtensible
in interface TupleType
public boolean matches(Item item, TypeHierarchy th) throws XPathException
matches
in interface ItemType
matches
in class AnyFunctionType
item
- The item to be testedth
- type hierarchy dataXPathException
public int getArity()
public SequenceType[] getArgumentTypes()
getArgumentTypes
in interface FunctionItemType
getArgumentTypes
in class AnyFunctionType
public SequenceType getResultType()
getResultType
in interface FunctionItemType
getResultType
in class AnyFunctionType
public java.lang.String toString()
toString
in interface ItemType
toString
in class AnyFunctionType
public java.lang.String toExportString()
toExportString
in interface ItemType
public boolean equals(java.lang.Object other)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public int relationship(FunctionItemType other, TypeHierarchy th)
relationship
in interface FunctionItemType
relationship
in class AnyFunctionType
TypeHierarchy.SUBSUMES
, TypeHierarchy.SAME_TYPE
public java.util.Optional<java.lang.String> explainMismatch(Item item, TypeHierarchy th)
explainMismatch
in interface ItemType
item
- the item being matchedth
- the type hierarchy cachepublic Expression makeFunctionSequenceCoercer(Expression exp, RoleDiagnostic role) throws XPathException
AnyFunctionType
makeFunctionSequenceCoercer
in interface FunctionItemType
makeFunctionSequenceCoercer
in class AnyFunctionType
exp
- the expression that delivers the supplied sequence of function items (the ones in need of coercion)role
- information for use in diagnosticsXPathException
public java.lang.String generateJavaScriptItemTypeTest(ItemType knownToBe, int targetVersion) throws XPathException
generateJavaScriptItemTypeTest
in interface ItemType
generateJavaScriptItemTypeTest
in class AnyFunctionType
knownToBe
- a type that this item is known to conform totargetVersion
- the target version of Saxon-JSXPathException
- if JS code cannot be generated for this item type, for example because
the test is schema-aware.Copyright (c) 2004-2020 Saxonica Limited. All rights reserved.