Class ExternalObjectType

java.lang.Object
net.sf.saxon.type.AnyExternalObjectType
net.sf.saxon.type.ExternalObjectType
All Implemented Interfaces:
ItemType
Direct Known Subclasses:
JavaExternalObjectType

public abstract class ExternalObjectType extends AnyExternalObjectType
This class represents the type of an external object returned by an extension function, or supplied as an external variable/parameter.
  • Constructor Details

    • ExternalObjectType

      public ExternalObjectType()
  • Method Details

    • getName

      public abstract String getName()
      Get the name of this type.
      Returns:
      the fully qualified name of the Java or .NET class.
    • getTargetNamespace

      public abstract String getTargetNamespace()
      Get the target namespace of this type. For Java this is always NamespaceConstant.JAVA_TYPE. For .net it is always NamespaceConstant.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

      public abstract StructuredQName 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:
      isPlainType in interface ItemType
      Overrides:
      isPlainType in class AnyExternalObjectType
      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:
      generateJavaScriptItemTypeTest in interface ItemType
      Overrides:
      generateJavaScriptItemTypeTest in class AnyExternalObjectType
      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:
      generateJavaScriptItemTypeAcceptor in interface ItemType
      Overrides:
      generateJavaScriptItemTypeAcceptor in class AnyExternalObjectType
      Parameters:
      errorCode - the error to be thrown if conversion is not possible
      targetVersion - 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