Class 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.
    • Field Detail

      • javaClass

        protected java.lang.Class<?> javaClass
    • Constructor Detail

      • JavaExternalObjectType

        public JavaExternalObjectType​(java.lang.Class<?> javaClass)
        Create an external object type.
        Parameters:
        javaClass - the Java class to which this type corresponds
    • Method Detail

      • getName

        public java.lang.String getName()
        Get the local name of this type.
        Specified by:
        getName in class ExternalObjectType
        Returns:
        the fully qualified name of the Java class.
      • getTargetNamespace

        public java.lang.String getTargetNamespace()
        Get the target namespace of this type. The is always NamespaceConstant.JAVA_TYPE.
        Specified by:
        getTargetNamespace in class ExternalObjectType
        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:
        getTypeName in class ExternalObjectType
        Returns:
        the name of the atomic type, or null if the type is anonymous.
      • getRelationship

        public Affinity 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 Affinity, for example Affinity.SUBSUMES
      • getJavaClass

        public java.lang.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:
        matches in interface ItemType
        Overrides:
        matches in class AnyExternalObjectType
        Parameters:
        item - The item to be tested
        th - The type hierarchy cache
        Returns:
        true if the item is an instance of this type; false otherwise
      • getDisplayName

        public java.lang.String getDisplayName()
      • hashCode

        public int hashCode()
        Returns a hash code value for the object.
        Overrides:
        hashCode in class java.lang.Object
      • equals

        public boolean equals​(java.lang.Object obj)
        Test whether two ExternalObjectType objects represent the same type
        Overrides:
        equals in class java.lang.Object
        Parameters:
        obj - the other ExternalObjectType
        Returns:
        true if the two objects represent the same type
      • classNameToLocalName

        public static java.lang.String classNameToLocalName​(java.lang.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 java.lang.String localNameToClassName​(java.lang.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​(java.lang.String className)
        Static method to get the QName corresponding to a Java class name