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 Details Link icon

    • javaClass Link icon

      protected Class<?> javaClass
  • Method Details Link icon

    • of Link icon

      public static JavaExternalObjectType of(Class<?> javaClass)
      Allocate an external object type. for a given Java class. Reuses a known JavaExternalObjectType if found in a static cache
      Parameters:
      javaClass - the Java class to which this type corresponds
      Returns:
      the corresponding JavaExternalObjectType
    • getName Link icon

      public 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 Link icon

      public 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 Link icon

      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.
    • getPrimitiveItemType Link icon

      public ItemType getPrimitiveItemType()
      Get the primitive item type corresponding to this item type.
      Specified by:
      getPrimitiveItemType in interface ItemType
      Overrides:
      getPrimitiveItemType in class AnyExternalObjectType
      Returns:
      EXTERNAL_OBJECT_TYPE, the ExternalObjectType that encapsulates the Java type Object.class.
    • getRelationship Link icon

      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 Link icon

      public Class<?> getJavaClass()
      Get the Java class to which this external object type corresponds
      Returns:
      the corresponding Java class
    • matches Link icon

      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
    • toString Link icon

      public String toString()
      Overrides:
      toString in class ExternalObjectType
    • getDisplayName Link icon

      public String getDisplayName()
    • hashCode Link icon

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

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

      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 Link icon

      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 Link icon

      public static StructuredQName classNameToQName(String className)
      Static method to get the QName corresponding to a Java class name