|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectnet.sf.saxon.type.ExternalObjectType
public class ExternalObjectType
This class represents the type of an external Java object returned by an extension function, or supplied as an external variable/parameter.
| Field Summary |
|---|
| Fields inherited from interface net.sf.saxon.type.SimpleType |
|---|
VARIETY_ATOMIC, VARIETY_LIST, VARIETY_UNION, VARIETY_UNSPECIFIED_SIMPLE |
| Fields inherited from interface net.sf.saxon.type.SchemaType |
|---|
DERIVATION_EXTENSION, DERIVATION_LIST, DERIVATION_RESTRICTION, DERIVATION_UNION, DERIVE_BY_SUBSTITUTION |
| Fields inherited from interface net.sf.saxon.type.SchemaComponent |
|---|
FIXED_UP, INCOMPLETE, INVALID, UNVALIDATED, VALIDATED, VALIDATING |
| Constructor Summary | |
|---|---|
ExternalObjectType(Class javaClass)
Create an anonymous external object type. |
|
ExternalObjectType(Class javaClass,
Configuration config)
Create an external object type. |
|
| Method Summary | |
|---|---|
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,
StaticContext env)
Analyze an expression to see whether the expression is capable of delivering a value of this type. |
static void |
analyzeContentExpression(SimpleType simpleType,
Expression expression,
StaticContext env,
int kind)
Analyze an expression to see whether the expression is capable of delivering a value of this type. |
CharSequence |
applyWhitespaceNormalization(CharSequence value)
Apply the whitespace normalization rules for this simple type |
Value |
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(Object obj)
Test whether two ExternalObjectType objects represent the same 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-signnificant 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. |
double |
getDefaultPriority()
Determine the default priority of this item type when used on its own as a Pattern |
int |
getDerivationMethod()
Gets the integer code of the derivation method used to derive this type from its parent. |
String |
getDescription()
Get a description of this type for use in error messages. |
String |
getDisplayName()
Get the display name of the type: that is, a lexical QName with an arbitrary prefix |
int |
getFingerprint()
Get the fingerprint of the name of this type |
Class |
getJavaClass()
Get the Java class to which this external object type corresponds |
SchemaType |
getKnownBaseType()
Returns the base type that this type inherits from. |
String |
getName()
Get the local name of this type |
int |
getNameCode()
Get the namecode of the name of this type. |
Set<PlainType> |
getPlainMemberTypes()
Get the set of atomic types that are subsumed by this type |
ItemType |
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. |
int |
getRelationship(ExternalObjectType other)
Get the relationship of this external object type to another external object type |
ItemType |
getSuperType(TypeHierarchy th)
Get the type from which this item type is derived by restriction. |
String |
getSystemId()
Get the URI of the schema document where the type was originally defined. |
String |
getTargetNamespace()
Get the target namespace of this type |
SequenceIterator |
getTypedValue(CharSequence value,
NamespaceResolver resolver,
ConversionRules rules)
Get the typed value corresponding to a given string value, assuming it is valid against this type |
SequenceIterator |
getTypedValue(NodeInfo node)
Get the typed value of a node that is annotated with this schema type |
StructuredQName |
getTypeName()
Get the name of this type as a StructuredQName, unless the type is anonymous, in which case return null |
int |
getValidationStatus()
Get the validation status - always valid |
int |
getWhitespaceAction()
Determine the whitespace normalization required for values of this type |
int |
hashCode()
Returns a hash code value for the object. |
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 |
isAnonymousType()
Test 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()
Test 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 |
isOrdered()
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 |
isPrimitiveType()
Determine 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,
XPathContext context)
Test whether a given item conforms to this type |
boolean |
matchesItem(Item item,
boolean allowURIPromotion,
Configuration config)
Test whether a given item conforms to this type |
CharSequence |
postprocess(CharSequence input)
Reverse any pre-lexical facets, other than whitespace. |
CharSequence |
preprocess(CharSequence input)
Apply any pre-lexical facets, other than whitespace. |
String |
toString()
|
String |
toString(NamePool pool)
Produce a representation of this type name for use in error messages. |
ValidationFailure |
validate(AtomicValue primValue,
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(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 |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public ExternalObjectType(Class javaClass)
javaClass - the Java class to which this type corresponds
public ExternalObjectType(Class javaClass,
Configuration config)
javaClass - the Java class to which this type correspondsconfig - the Saxon configuration| Method Detail |
|---|
public String getName()
getName in interface SchemaTypepublic String getTargetNamespace()
getTargetNamespace in interface SchemaTypepublic boolean isExternalType()
isExternalType in interface PlainTypeisExternalType in interface SimpleTypepublic boolean isBuiltInType()
isBuiltInType in interface AtomicTypeisBuiltInType in interface SimpleTypepublic StructuredQName getTypeName()
getTypeName in interface AtomicTypepublic int getRedefinitionLevel()
getRedefinitionLevel in interface SchemaComponentpublic boolean isAbstract()
isAbstract in interface AtomicTypepublic boolean isPrimitiveType()
isPrimitiveType in interface AtomicTypepublic boolean isOrdered()
isOrdered in interface AtomicTypepublic boolean isPlainType()
isPlainType in interface ItemTypepublic String getSystemId()
getSystemId in interface SchemaTypepublic final int getValidationStatus()
getValidationStatus in interface SchemaComponentSchemaComponent.UNVALIDATED, SchemaComponent.VALIDATING,
SchemaComponent.VALIDATED, SchemaComponent.INVALID, SchemaComponent.INCOMPLETEpublic final int getBlock()
SchemaType.DERIVATION_LIST and SchemaType.DERIVATION_EXTENSION
getBlock in interface SchemaTypepublic final int getDerivationMethod()
getDerivationMethod in interface SchemaTypeSchemaType.DERIVATION_RESTRICTIONpublic final boolean allowsDerivation(int derivation)
allowsDerivation in interface SchemaTypederivation - the kind of derivation, for example SchemaType.DERIVATION_LIST
public int getNameCode()
getNameCode in interface SchemaTypepublic final boolean isComplexType()
isComplexType in interface SchemaTypepublic final SchemaType getBaseType()
getBaseType in interface SchemaTypeIllegalStateException - if this type is not valid.public ItemType getPrimitiveItemType()
getPrimitiveItemType in interface ItemTypepublic int getPrimitiveType()
getPrimitiveType in interface ItemTypepublic String toString(NamePool pool)
toString in interface ItemTypepool - the name pool
public AtomicType getAtomizedItemType()
getAtomizedItemType in interface ItemTypepublic boolean isAtomizable()
isAtomizable in interface ItemTypepublic SchemaType getKnownBaseType()
IllegalStateException - if this type is not valid.public boolean isSameType(SchemaType other)
isSameType in interface SchemaTypeother - the other type
public int getRelationship(ExternalObjectType other)
other - the other external object type
TypeHierarchy, for example TypeHierarchy.SUBSUMESpublic String getDescription()
SchemaType
getDescription in interface SchemaType
public void checkTypeDerivationIsOK(SchemaType type,
int block)
throws SchemaException
checkTypeDerivationIsOK in interface SchemaTypetype - the type from which this type is derivedblock - the derivations that are blocked by the relevant element declaration
SchemaException - if the derivation is not allowedpublic final boolean isSimpleType()
isSimpleType in interface SchemaTypepublic boolean isAtomicType()
isAtomicType in interface ItemTypeisAtomicType in interface SchemaTypeisAtomicType in interface SimpleTypepublic boolean isIdType()
isIdType in interface SchemaTypepublic boolean isIdRefType()
isIdRefType in interface SchemaTypepublic boolean isListType()
isListType in interface SimpleTypepublic boolean isUnionType()
isUnionType in interface SimpleTypepublic int getWhitespaceAction()
getWhitespaceAction in interface SimpleType
public CharSequence applyWhitespaceNormalization(CharSequence value)
throws ValidationException
value - the string before whitespace normalization
ValidationExceptionpublic SchemaType getBuiltInBaseType()
getBuiltInBaseType in interface SimpleTypepublic boolean isNamespaceSensitive()
isNamespaceSensitive in interface SimpleTypepublic boolean isAnonymousType()
isAnonymousType in interface SchemaTypepublic final SequenceIterator getTypedValue(NodeInfo node)
getTypedValue in interface SchemaTypenode - the node whose typed value is required
AtomicValue
public Value atomize(NodeInfo node)
throws XPathException
getTypedValue(net.sf.saxon.om.NodeInfo). However, this method is often more convenient and may be
more efficient, especially in the common case where the value is expected to be a singleton.
atomize in interface SchemaTypenode - the node whose typed value is required
XPathException - if the node cannot be atomized, for example if this is a complex type
with element-only content
public SequenceIterator getTypedValue(CharSequence value,
NamespaceResolver resolver,
ConversionRules rules)
throws ValidationException
getTypedValue in interface SimpleTypevalue - 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 -
AtomicValue
ValidationException - if the supplied value is not in the lexical space of the data type
public ValidationFailure validate(AtomicValue primValue,
CharSequence lexicalValue,
ConversionRules rules)
validate in interface AtomicTypeprimValue - 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 -
UnsupportedOperationException - in the case of an external object type
public void analyzeContentExpression(Expression expression,
int kind,
StaticContext env)
throws XPathException
analyzeContentExpression in interface SchemaTypeexpression - the expression that delivers the contentkind - the node kind whose content is being delivered: Type.ELEMENT,
Type.ATTRIBUTE, or Type.DOCUMENTenv - the static evaluation context
XPathException - if the expression will never deliver a value of the correct type
public static void analyzeContentExpression(SimpleType simpleType,
Expression expression,
StaticContext env,
int kind)
throws XPathException
simpleType - the simple type against which the expression is to be checkedexpression - the expression that delivers the contentenv - the static evaluation contextkind - 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 Class getJavaClass()
public boolean matches(Item item,
XPathContext context)
matches in interface ItemTypeitem - The item to be testedcontext - the XPath dynamic evaluation context
public boolean matchesItem(Item item,
boolean allowURIPromotion,
Configuration config)
matchesItem in interface ItemTypeitem - The item to be testedallowURIPromotion - config -
public ValidationFailure validateContent(CharSequence value,
NamespaceResolver nsResolver,
ConversionRules rules)
validateContent in interface SimpleTypevalue - 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 -
UnsupportedOperationException - if the type is namespace-sensitive and no namespace
resolver is suppliedpublic ItemType getSuperType(TypeHierarchy th)
ItemTypeIn fact the concept of "supertype" is not really well-defined, because the types form a lattice rather than a hierarchy. The only real requirement on this function is that it returns a type that strictly subsumes this type, ideally as narrowly as possible.
getSuperType in interface ItemTypeth - the type hierarchy cache
public int getFingerprint()
SchemaType
getFingerprint in interface SchemaTypepublic String toString()
toString in class Objectpublic String getDisplayName()
SchemaType
getDisplayName in interface SchemaTypepublic int hashCode()
hashCode in class Objectpublic boolean equals(Object obj)
equals in class Objectobj - the other ExternalObjectType
public CharSequence preprocess(CharSequence input)
preprocess in interface SimpleTypeinput - the value to be preprocessed
public CharSequence postprocess(CharSequence input)
throws ValidationException
postprocess in interface SimpleTypeinput - the value to be postprocessed: this is the "ordinary" result of converting
the value to a string
ValidationException - if postprocessing detects that the value is invalid
public void visitNamedSchemaComponents(SchemaComponentVisitor visitor)
throws XPathException
visitNamedSchemaComponents in interface ItemTypevisitor - the visitor class to be called when each component is visited
XPathException - if an error occurspublic Set<PlainType> getPlainMemberTypes()
getPlainMemberTypes in interface PlainTypepublic double getDefaultPriority()
ItemType
getDefaultPriority in interface ItemType
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||