public class BuiltInAtomicType extends java.lang.Object implements AtomicType, ItemType.WithSequenceTypeCache
ItemType.WithSequenceTypeCache
DERIVATION_EXTENSION, DERIVATION_LIST, DERIVATION_RESTRICTION, DERIVATION_UNION, DERIVE_BY_SUBSTITUTION
COMPONENT_FUNCTION_TYPE, FIXED_UP, INCOMPLETE, INVALID, UNVALIDATED, VALIDATED, VALIDATING
Modifier and Type | Method and Description |
---|---|
boolean |
allowsDerivation(int derivation)
Determines whether derivation (of a particular kind)
from this type is allowed, based on the "final" property
|
void |
analyzeContentExpression(Expression expression,
int kind)
Analyze an expression to see whether the expression is capable of delivering a value of this
type.
|
static void |
analyzeContentExpression(SimpleType simpleType,
Expression expression,
int kind)
Analyze an expression to see whether the expression is capable of delivering a value of this
type.
|
AtomicSequence |
atomize(NodeInfo node)
Get the typed value of a node that is annotated with this schema type.
|
void |
checkTypeDerivationIsOK(SchemaType type,
int block)
Check that this type is validly derived from a given type
|
boolean |
equals(java.lang.Object obj)
Two types are equal if they have the same fingerprint.
|
java.lang.String |
generateJavaScriptItemTypeAcceptor(java.lang.String errorCode,
int targetVersion)
Generate Javascript code to convert a supplied Javascript value to this item type,
if conversion is possible, or throw an error otherwise.
|
java.lang.String |
generateJavaScriptItemTypeTest(ItemType knownToBe,
int targetVersion)
Generate Javascript code to test whether an item conforms to this item type
|
AtomicType |
getAtomizedItemType()
Get the item type of the atomic values that will be produced when an item
of this type is atomized
|
SchemaType |
getBaseType()
Returns the base type that this type inherits from.
|
int |
getBlock()
Returns the value of the 'block' attribute for this type, as a bit-significant
integer with fields such as
SchemaType.DERIVATION_LIST and SchemaType.DERIVATION_EXTENSION |
SchemaType |
getBuiltInBaseType()
Returns the built-in base type this type is derived from.
|
Function |
getComponentAsFunction()
Get the schema component in the form of a function item.
|
int |
getDerivationMethod()
Gets the integer code of the derivation method used to derive this type from its
parent.
|
java.lang.String |
getDescription()
Get a description of this type for use in error messages.
|
java.lang.String |
getDisplayName()
Get the display name of the type: that is, a lexical QName with an arbitrary prefix
|
java.lang.String |
getEQName()
Get the name of this type as an EQName, that is, a string in the format Q{uri}local.
|
int |
getFinalProhibitions()
Get the types of derivation that are not permitted, by virtue of the "final" property.
|
int |
getFingerprint()
Get the fingerprint of the name of this type
|
SchemaType |
getKnownBaseType()
Returns the base type that this type inherits from.
|
java.lang.String |
getName()
Get the local name of this type
|
java.util.Set<? extends PlainType> |
getPlainMemberTypes()
Get the list of plain types that are subsumed by this type
|
BuiltInAtomicType |
getPrimitiveItemType()
Get the primitive item type corresponding to this item type.
|
int |
getPrimitiveType()
Get the primitive type corresponding to this item type.
|
int |
getRedefinitionLevel()
Get the redefinition level.
|
StringConverter |
getStringConverter(ConversionRules rules)
Get a StringConverter, an object that converts strings in the lexical space of this
data type to instances (in the value space) of the data type.
|
StructuredQName |
getStructuredQName()
Get the name of the type as a QName
|
java.lang.String |
getSystemId()
Get the URI of the schema document where the type was originally defined.
|
java.lang.String |
getTargetNamespace()
Get the target namespace of this type
|
AtomicSequence |
getTypedValue(java.lang.CharSequence value,
NamespaceResolver resolver,
ConversionRules rules)
Get the typed value corresponding to a given string value, assuming it is
valid against this type (and that the containing node is not nilled)
|
StructuredQName |
getTypeName()
Get the name of this type as a StructuredQName, unless the type is anonymous, in which case
return null
|
UType |
getUType()
Get the corresponding
UType . |
int |
getValidationStatus()
Get the validation status - always valid
|
int |
getWhitespaceAction()
Determine the whitespace normalization required for values of this type
|
int |
hashCode()
The fingerprint can be used as a hashcode
|
boolean |
isAbstract()
Determine whether the type is abstract, that is, whether it cannot have instances that are not also
instances of some concrete subtype
|
boolean |
isAllowedInXSD10()
Determine whether this type is supported when using XSD 1.0
|
boolean |
isAnonymousType()
Ask whether this is an anonymous type
|
boolean |
isAtomicType()
Test whether this Simple Type is an atomic type
|
boolean |
isAtomizable()
Ask whether values of this type are atomizable
|
boolean |
isBuiltInType()
Determine whether this is a built-in type or a user-defined type
|
boolean |
isComplexType()
Ask whether this SchemaType is a complex type
|
boolean |
isExternalType()
Return true if this is an external object type, that is, a Saxon-defined type for external
Java or .NET objects
|
boolean |
isIdRefType()
Ask whether this type is an IDREF or IDREFS type.
|
boolean |
isIdType()
Ask whether this type is an ID type.
|
boolean |
isListType()
Returns true if this type is derived by list, or if it is derived by restriction
from a list type, or if it is a union that contains a list as one of its members
|
boolean |
isNamespaceSensitive()
Test whether this simple type is namespace-sensitive, that is, whether
it is derived from xs:QName or xs:NOTATION
|
boolean |
isNumericType()
Ask whether a built-in type is a numeric type (integer, float, double)
|
boolean |
isOrdered(boolean optimistic)
Determine whether the atomic type is ordered, that is, whether less-than and greater-than comparisons
are permitted
|
boolean |
isPlainType()
Ask whether this is a plain type (a type whose instances are always atomic values)
|
boolean |
isPrimitiveNumeric()
Determine whether the atomic type is numeric
|
boolean |
isPrimitiveType()
Ask whether the atomic type is a primitive type.
|
boolean |
isSameType(SchemaType other)
Test whether this is the same type as another type.
|
boolean |
isSimpleType()
Returns true if this SchemaType is a SimpleType
|
boolean |
isUnionType()
Return true if this type is a union type (that is, if its variety is union)
|
boolean |
matches(Item item,
TypeHierarchy th)
Test whether a given item conforms to this type
|
SequenceType |
one()
Get a sequence type representing exactly one instance of this atomic type
|
SequenceType |
oneOrMore()
Get a sequence type representing one or more instances of this atomic type
|
java.lang.CharSequence |
postprocess(java.lang.CharSequence input)
Reverse any pre-lexical facets, other than whitespace.
|
java.lang.CharSequence |
preprocess(java.lang.CharSequence input)
Apply any pre-lexical facets, other than whitespace.
|
void |
setBaseTypeFingerprint(int baseFingerprint)
Set the base type of this type
|
java.lang.String |
toExportString()
Return a string representation of this SequenceType suitable for use in export (SEF) files.
|
java.lang.String |
toString() |
ValidationFailure |
validate(AtomicValue primValue,
java.lang.CharSequence lexicalValue,
ConversionRules rules)
Validate that a primitive atomic value is a valid instance of a type derived from the
same primitive type.
|
ValidationFailure |
validateContent(java.lang.CharSequence value,
NamespaceResolver nsResolver,
ConversionRules rules)
Check whether a given input string is valid according to this SimpleType
|
void |
visitNamedSchemaComponents(SchemaComponentVisitor visitor)
Visit all the schema components used in this ItemType definition
|
SequenceType |
zeroOrMore()
Get a sequence type representing one or more instances of this atomic type
|
SequenceType |
zeroOrOne()
Get a sequence type representing zero or one instances of this atomic type
|
public StringConverter stringConverter
public static final BuiltInAtomicType ANY_ATOMIC
public static final BuiltInAtomicType STRING
public static final BuiltInAtomicType BOOLEAN
public static final BuiltInAtomicType DURATION
public static final BuiltInAtomicType DATE_TIME
public static final BuiltInAtomicType DATE
public static final BuiltInAtomicType TIME
public static final BuiltInAtomicType G_YEAR_MONTH
public static final BuiltInAtomicType G_MONTH
public static final BuiltInAtomicType G_MONTH_DAY
public static final BuiltInAtomicType G_YEAR
public static final BuiltInAtomicType G_DAY
public static final BuiltInAtomicType HEX_BINARY
public static final BuiltInAtomicType BASE64_BINARY
public static final BuiltInAtomicType ANY_URI
public static final BuiltInAtomicType QNAME
public static final BuiltInAtomicType NOTATION
public static final BuiltInAtomicType UNTYPED_ATOMIC
public static final BuiltInAtomicType DECIMAL
public static final BuiltInAtomicType FLOAT
public static final BuiltInAtomicType DOUBLE
public static final BuiltInAtomicType INTEGER
public static final BuiltInAtomicType NON_POSITIVE_INTEGER
public static final BuiltInAtomicType NEGATIVE_INTEGER
public static final BuiltInAtomicType LONG
public static final BuiltInAtomicType INT
public static final BuiltInAtomicType SHORT
public static final BuiltInAtomicType BYTE
public static final BuiltInAtomicType NON_NEGATIVE_INTEGER
public static final BuiltInAtomicType POSITIVE_INTEGER
public static final BuiltInAtomicType UNSIGNED_LONG
public static final BuiltInAtomicType UNSIGNED_INT
public static final BuiltInAtomicType UNSIGNED_SHORT
public static final BuiltInAtomicType UNSIGNED_BYTE
public static final BuiltInAtomicType YEAR_MONTH_DURATION
public static final BuiltInAtomicType DAY_TIME_DURATION
public static final BuiltInAtomicType NORMALIZED_STRING
public static final BuiltInAtomicType TOKEN
public static final BuiltInAtomicType LANGUAGE
public static final BuiltInAtomicType NAME
public static final BuiltInAtomicType NMTOKEN
public static final BuiltInAtomicType NCNAME
public static final BuiltInAtomicType ID
public static final BuiltInAtomicType IDREF
public static final BuiltInAtomicType ENTITY
public static final BuiltInAtomicType DATE_TIME_STAMP
public java.lang.String getName()
getName
in interface SchemaType
public UType getUType()
UType
. A UType is a union of primitive item
types.public java.lang.String getTargetNamespace()
getTargetNamespace
in interface SchemaType
public java.lang.String getEQName()
getEQName
in interface SchemaType
public boolean isAbstract()
isAbstract
in interface AtomicType
public boolean isExternalType()
isExternalType
in interface PlainType
isExternalType
in interface SimpleType
public boolean isBuiltInType()
isBuiltInType
in interface AtomicType
isBuiltInType
in interface SimpleType
public StructuredQName getTypeName()
getTypeName
in interface AtomicType
getTypeName
in interface PlainType
public SequenceType one()
one
in interface ItemType.WithSequenceTypeCache
public SequenceType zeroOrOne()
zeroOrOne
in interface ItemType.WithSequenceTypeCache
public SequenceType oneOrMore()
oneOrMore
in interface ItemType.WithSequenceTypeCache
public SequenceType zeroOrMore()
zeroOrMore
in interface ItemType.WithSequenceTypeCache
public int getRedefinitionLevel()
getRedefinitionLevel
in interface SchemaComponent
public boolean isOrdered(boolean optimistic)
isOrdered
in interface AtomicType
optimistic
- if true, the function takes an optimistic view, returning true if ordering comparisons
are available for some subtype. This mainly affects xs:duration, where the function returns true if
optimistic is true, false if it is false.public java.lang.String getSystemId()
getSystemId
in interface SchemaType
public boolean isPrimitiveNumeric()
public final int getValidationStatus()
getValidationStatus
in interface SchemaComponent
SchemaComponent.UNVALIDATED
, SchemaComponent.VALIDATING
,
SchemaComponent.VALIDATED
, SchemaComponent.INVALID
, SchemaComponent.INCOMPLETE
public final int getBlock()
SchemaType.DERIVATION_LIST
and SchemaType.DERIVATION_EXTENSION
getBlock
in interface SchemaType
public final int getDerivationMethod()
getDerivationMethod
in interface SchemaType
SchemaType.DERIVATION_RESTRICTION
public final boolean allowsDerivation(int derivation)
allowsDerivation
in interface SchemaType
derivation
- the kind of derivation, for example SchemaType.DERIVATION_LIST
public int getFinalProhibitions()
getFinalProhibitions
in interface SchemaType
SchemaType.DERIVATION_EXTENSION
public final void setBaseTypeFingerprint(int baseFingerprint)
baseFingerprint
- the namepool fingerprint of the name of the base typepublic final int getFingerprint()
getFingerprint
in interface SchemaType
public final StructuredQName getStructuredQName()
getStructuredQName
in interface SchemaType
public java.lang.String getDisplayName()
getDisplayName
in interface SchemaType
public final boolean isPrimitiveType()
isPrimitiveType
in interface AtomicType
public final boolean isComplexType()
isComplexType
in interface SchemaType
public final boolean isAnonymousType()
isAnonymousType
in interface SchemaType
public boolean isPlainType()
isPlainType
in interface ItemType
public final SchemaType getBaseType()
getBaseType
in interface SchemaType
java.lang.IllegalStateException
- if this type is not valid.public boolean matches(Item item, TypeHierarchy th)
public BuiltInAtomicType getPrimitiveItemType()
getPrimitiveItemType
in interface ItemType
getPrimitiveItemType
in interface PlainType
public int getPrimitiveType()
getPrimitiveType
in interface ItemType
public boolean isAllowedInXSD10()
public java.lang.String toString()
public java.lang.String toExportString()
toExportString
in interface ItemType
public AtomicType getAtomizedItemType()
getAtomizedItemType
in interface ItemType
public boolean isAtomizable()
isAtomizable
in interface ItemType
public SchemaType getKnownBaseType()
java.lang.IllegalStateException
- if this type is not valid.public boolean isSameType(SchemaType other)
isSameType
in interface SchemaType
other
- the other typepublic java.lang.String getDescription()
SchemaType
getDescription
in interface SchemaType
public void checkTypeDerivationIsOK(SchemaType type, int block) throws SchemaException
checkTypeDerivationIsOK
in interface SchemaType
type
- the type from which this type is derivedblock
- the derivations that are blocked by the relevant element declarationSchemaException
- if the derivation is not allowedpublic final boolean isSimpleType()
isSimpleType
in interface SchemaType
public boolean isAtomicType()
isAtomicType
in interface ItemType
isAtomicType
in interface SchemaType
isAtomicType
in interface SimpleType
public boolean isIdType()
isIdType
in interface SchemaType
public boolean isIdRefType()
isIdRefType
in interface SchemaType
public boolean isListType()
isListType
in interface SimpleType
public boolean isUnionType()
isUnionType
in interface SimpleType
public int getWhitespaceAction()
getWhitespaceAction
in interface SimpleType
public SchemaType getBuiltInBaseType()
getBuiltInBaseType
in interface SimpleType
public boolean isNamespaceSensitive()
isNamespaceSensitive
in interface SimpleType
public ValidationFailure validateContent(java.lang.CharSequence value, NamespaceResolver nsResolver, ConversionRules rules)
validateContent
in interface SimpleType
value
- the input string to be checkednsResolver
- a namespace resolver used to resolve namespace prefixes if the type
is namespace sensitive. The value supplied may be null; in this case any namespace-sensitive
content will throw an UnsupportedOperationException.rules
- conversion rules e.g for namespace-sensitive contentjava.lang.UnsupportedOperationException
- if the type is namespace-sensitive and no namespace
resolver is suppliedpublic StringConverter getStringConverter(ConversionRules rules)
getStringConverter
in interface AtomicType
rules
- the conversion rules to be usedpublic AtomicSequence atomize(NodeInfo node) throws XPathException
atomize
in interface SchemaType
node
- the node whose typed value is requiredXPathException
- if the node cannot be atomized, for example if this is a complex type
with element-only contentpublic AtomicSequence getTypedValue(java.lang.CharSequence value, NamespaceResolver resolver, ConversionRules rules) throws ValidationException
getTypedValue
in interface SimpleType
value
- the string valueresolver
- a namespace resolver used to resolve any namespace prefixes appearing
in the content of values. Can supply null, in which case any namespace-sensitive content
will be rejected.rules
- the conversion rules to be usedAtomicValue
ValidationException
- This method should be called only if it is known that the value is
valid. If the value is not valid, there is no guarantee that this method will perform validation,
but if it does detect a validity error, then it MAY throw a ValidationException.public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public ValidationFailure validate(AtomicValue primValue, java.lang.CharSequence lexicalValue, ConversionRules rules)
validate
in interface AtomicType
primValue
- the value in the value space of the primitive type.lexicalValue
- the value in the lexical space. If null, the string value of primValue
is used. This value is checked against the pattern facet (if any)rules
- the conversion rules to be usedjava.lang.UnsupportedOperationException
- in the case of an external object typepublic void analyzeContentExpression(Expression expression, int kind) throws XPathException
analyzeContentExpression
in interface SchemaType
expression
- the expression that delivers the contentkind
- the node kind whose content is being delivered: Type.ELEMENT
,
Type.ATTRIBUTE
, or Type.DOCUMENT
XPathException
- if the expression will never deliver a value of the correct typepublic static void analyzeContentExpression(SimpleType simpleType, Expression expression, int kind) throws XPathException
simpleType
- the simple type against which the expression is to be checkedexpression
- the expression that delivers the contentkind
- the node kind whose content is being delivered: Type.ELEMENT
,
Type.ATTRIBUTE
, or Type.DOCUMENT
XPathException
- if the expression will never deliver a value of the correct typepublic java.lang.CharSequence preprocess(java.lang.CharSequence input)
preprocess
in interface SimpleType
input
- the value to be preprocessedpublic java.lang.CharSequence postprocess(java.lang.CharSequence input) throws ValidationException
postprocess
in interface SimpleType
input
- the value to be postprocessed: this is the "ordinary" result of converting
the value to a stringValidationException
- if postprocessing detects that the value is invalidpublic void visitNamedSchemaComponents(SchemaComponentVisitor visitor) throws XPathException
visitNamedSchemaComponents
in interface ItemType
visitor
- the visitor class to be called when each component is visitedXPathException
- if an error occurspublic java.util.Set<? extends PlainType> getPlainMemberTypes()
getPlainMemberTypes
in interface PlainType
public boolean isNumericType()
public java.lang.String generateJavaScriptItemTypeTest(ItemType knownToBe, int targetVersion) throws XPathException
generateJavaScriptItemTypeTest
in interface ItemType
knownToBe
- a type that the item is known to conform totargetVersion
- 1 or 2 depending on the version of Saxon-JS we are targetingXPathException
- if JS code cannot be generated for this item type, for example because
the test is schema-aware.public java.lang.String generateJavaScriptItemTypeAcceptor(java.lang.String errorCode, int targetVersion) throws XPathException
generateJavaScriptItemTypeAcceptor
in interface ItemType
errorCode
- the error to be thrown if conversion is not possibletargetVersion
- 1 or 2 depending on the version of Saxon-JS we are targetingXPathException
public Function getComponentAsFunction()
SchemaComponent
getComponentAsFunction
in interface SchemaComponent
Copyright (c) 2004-2018 Saxonica Limited. All rights reserved.