Package net.sf.saxon.type
Class ExternalObjectType
java.lang.Object
net.sf.saxon.type.AnyExternalObjectType
net.sf.saxon.type.ExternalObjectType
- All Implemented Interfaces:
ItemType
- Direct Known Subclasses:
JavaExternalObjectType
This class represents the type of an external object returned by
an extension function, or supplied as an external variable/parameter.
-
Nested Class Summary
Nested classes/interfaces inherited from interface net.sf.saxon.type.ItemType
ItemType.WithSequenceTypeCache -
Field Summary
Fields inherited from class net.sf.saxon.type.AnyExternalObjectType
THE_INSTANCE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongenerateJavaScriptItemTypeAcceptor(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.generateJavaScriptItemTypeTest(ItemType knownToBe, int targetVersion) Generate Javascript code to test whether an item conforms to this item typeabstract StringgetName()Get the name of this type.abstract StringGet the target namespace of this type.abstract StructuredQNameGet the name of this typebooleanAsk whether this is an external typefinal booleanAsk whether this is a plain type (a type whose instances are always atomic values)Methods inherited from class net.sf.saxon.type.AnyExternalObjectType
getAlphaCode, getAtomizedItemType, getGenre, getPrimitiveItemType, getPrimitiveType, getUType, isAtomicType, isAtomizable, matchesMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface net.sf.saxon.type.ItemType
explainMismatch, isTrueItemType, toExportString, toString
-
Constructor Details
-
ExternalObjectType
public ExternalObjectType()
-
-
Method Details
-
getName
Get the name of this type.- Returns:
- the fully qualified name of the Java or .NET class.
-
getTargetNamespace
Get the target namespace of this type. For Java this is alwaysNamespaceConstant.JAVA_TYPE. For .net it is alwaysNamespaceConstant.DOT_NET_TYPE- Returns:
- the target namespace of this type definition.
-
isExternalType
public boolean isExternalType()Ask whether this is an external type- Returns:
- true (it is)
-
getTypeName
Get the name of this type- Returns:
- a name whose namespace indicates the space of Java or .net classes, and whose local name is derived from the fully qualified name of the Java or .net class
-
isPlainType
public final boolean isPlainType()Ask whether this is a plain type (a type whose instances are always atomic values)- Specified by:
isPlainTypein interfaceItemType- Overrides:
isPlainTypein classAnyExternalObjectType- Returns:
- false. External object types are not considered to be atomic types
-
generateJavaScriptItemTypeTest
public String generateJavaScriptItemTypeTest(ItemType knownToBe, int targetVersion) throws XPathException Generate Javascript code to test whether an item conforms to this item type- Specified by:
generateJavaScriptItemTypeTestin interfaceItemType- Overrides:
generateJavaScriptItemTypeTestin classAnyExternalObjectType- Parameters:
knownToBe-targetVersion-- Returns:
- a Javascript instruction or sequence of instructions, which can be used as the body of a Javascript function, and which returns a boolean indication whether the value of the variable "item" is an instance of this item type.
- Throws:
XPathException- if JS code cannot be generated for this item type, for example because the test is schema-aware.
-
generateJavaScriptItemTypeAcceptor
public String generateJavaScriptItemTypeAcceptor(String errorCode, int targetVersion) throws XPathException Generate Javascript code to convert a supplied Javascript value to this item type, if conversion is possible, or throw an error otherwise.- Specified by:
generateJavaScriptItemTypeAcceptorin interfaceItemType- Overrides:
generateJavaScriptItemTypeAcceptorin classAnyExternalObjectType- Parameters:
errorCode- the error to be thrown if conversion is not possibletargetVersion- the version of Saxon-JS- Returns:
- a Javascript instruction or sequence of instructions, which can be used as the body of a Javascript function, and which returns the result of conversion to this type, or throws an error if conversion is not possible. The variable "val" will hold the supplied Javascript value.
- Throws:
XPathException
-