Package net.sf.saxon.type
Class JavaExternalObjectType
- java.lang.Object
-
- net.sf.saxon.type.AnyExternalObjectType
-
- net.sf.saxon.type.ExternalObjectType
-
- net.sf.saxon.type.JavaExternalObjectType
-
- All Implemented Interfaces:
ItemType
public class JavaExternalObjectType extends ExternalObjectType
This class represents the type of an external Java 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 Modifier and Type Field Description protected Configurationconfigprotected Class<?>javaClass-
Fields inherited from class net.sf.saxon.type.AnyExternalObjectType
THE_INSTANCE
-
-
Constructor Summary
Constructors Constructor Description JavaExternalObjectType(Configuration config, Class<?> javaClass)Create an external object type.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static StringclassNameToLocalName(String className)Static method to convert a Java class name to an XPath local name.static StructuredQNameclassNameToQName(String className)Static method to get the QName corresponding to a Java class namebooleanequals(Object obj)Test whether two ExternalObjectType objects represent the same typeConfigurationgetConfiguration()StringgetDisplayName()Class<?>getJavaClass()Get the Java class to which this external object type correspondsStringgetName()Get the local name of this type.ItemTypegetPrimitiveItemType()Get the primitive item type corresponding to this item type.intgetRelationship(JavaExternalObjectType other)Get the relationship of this external object type to another external object typeStringgetTargetNamespace()Get the target namespace of this type.StructuredQNamegetTypeName()Get the name of this type as a StructuredQName, unless the type is anonymous, in which case return nullinthashCode()Returns a hash code value for the object.static StringlocalNameToClassName(String className)Static method to convert an XPath local name to a Java class name.booleanmatches(Item item, TypeHierarchy th)Test whether a given item conforms to this typeStringtoString()-
Methods inherited from class net.sf.saxon.type.ExternalObjectType
generateJavaScriptItemTypeAcceptor, generateJavaScriptItemTypeTest, isExternalType, isPlainType
-
Methods inherited from class net.sf.saxon.type.AnyExternalObjectType
getAlphaCode, getAtomizedItemType, getGenre, getPrimitiveType, getUType, isAtomicType, isAtomizable
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface net.sf.saxon.type.ItemType
explainMismatch, isTrueItemType, toExportString
-
-
-
-
Field Detail
-
config
protected Configuration config
-
javaClass
protected Class<?> javaClass
-
-
Constructor Detail
-
JavaExternalObjectType
public JavaExternalObjectType(Configuration config, Class<?> javaClass)
Create an external object type.- Parameters:
javaClass- the Java class to which this type corresponds
-
-
Method Detail
-
getConfiguration
public Configuration getConfiguration()
-
getName
public String getName()
Get the local name of this type.- Specified by:
getNamein classExternalObjectType- Returns:
- the fully qualified name of the Java class.
-
getTargetNamespace
public String getTargetNamespace()
Get the target namespace of this type. The is always NamespaceConstant.JAVA_TYPE.- Specified by:
getTargetNamespacein classExternalObjectType- Returns:
- the target namespace of this type definition.
-
getTypeName
public StructuredQName getTypeName()
Get the name of this type as a StructuredQName, unless the type is anonymous, in which case return null- Specified by:
getTypeNamein classExternalObjectType- Returns:
- the name of the atomic type, or null if the type is anonymous.
-
getPrimitiveItemType
public ItemType getPrimitiveItemType()
Get the primitive item type corresponding to this item type.- Specified by:
getPrimitiveItemTypein interfaceItemType- Overrides:
getPrimitiveItemTypein classAnyExternalObjectType- Returns:
- EXTERNAL_OBJECT_TYPE, the ExternalObjectType that encapsulates the Java type Object.class.
-
getRelationship
public int getRelationship(JavaExternalObjectType other)
Get the relationship of this external object type to another external object type- Parameters:
other- the other external object type- Returns:
- the relationship of this external object type to another external object type,
as one of the constants in class
TypeHierarchy, for exampleTypeHierarchy.SUBSUMES
-
getJavaClass
public Class<?> getJavaClass()
Get the Java class to which this external object type corresponds- Returns:
- the corresponding Java class
-
matches
public boolean matches(Item item, TypeHierarchy th)
Test whether a given item conforms to this type- Specified by:
matchesin interfaceItemType- Overrides:
matchesin classAnyExternalObjectType- Parameters:
item- The item to be testedth- The type hierarchy cache- Returns:
- true if the item is an instance of this type; false otherwise
-
toString
public String toString()
-
getDisplayName
public String getDisplayName()
-
hashCode
public int hashCode()
Returns a hash code value for the object.
-
equals
public boolean equals(Object obj)
Test whether two ExternalObjectType objects represent the same type
-
classNameToLocalName
public static String classNameToLocalName(String className)
Static method to convert a Java class name to an XPath local name. This involves the following substitutions: "$" is replaced by "-", and "[" is replaced by "_-".
-
localNameToClassName
public static String localNameToClassName(String className)
Static method to convert an XPath local name to a Java class name. This involves the following substitutions: "-" is replaced by "$", and leading "_-" pairs are replaced by "[".
-
classNameToQName
public static StructuredQName classNameToQName(String className)
Static method to get the QName corresponding to a Java class name
-
-