Package net.sf.saxon.s9api

## Class XdmExternalObject

- java.lang.Object
- - net.sf.saxon.s9api.XdmValue
  - - net.sf.saxon.s9api.XdmItem
    - - net.sf.saxon.s9api.XdmExternalObject

- All Implemented Interfaces:
    `java.lang.Iterable<XdmItem>`

      public class XdmExternalObject
      extends XdmItem

  The class XdmExternalObject represents an XDM item that wraps an external (Java or .NET) object. As such, it is outside the scope of the XDM specification (but permitted as an extension).

  In releases prior to 9.5, external objects in Saxon were represented as atomic values. From 9.5 they are represented as a fourth kind of item, alongside nodes, atomic values, and functions.

- - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `XdmExternalObject​(java.lang.Object value)` | Create an XdmExternalObject that wraps a supplied Java object

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `boolean` | `equals​(java.lang.Object other)` | Compare two external objects for equality.
    `java.lang.Object` | `getExternalObject()` | Get the wrapped Java object
    `int` | `hashCode()` | Return a hash code for the object.
    `java.lang.String` | `toString()` | Get the result of converting the external value to a string.

    - ### Methods inherited from class net.sf.saxon.s9api.XdmItem

      `asMap, getStringValue, getUnderlyingValue, isAtomicValue, isNode, matches, size, stream, wrapItem, wrapItem, wrapItem`

    - ### Methods inherited from class net.sf.saxon.s9api.XdmValue

      `append, documentOrder, fromGroundedValue, isEmpty, itemAt, iterator, makeSequence, makeValue, select, setValue, wrap, wrap`

    - ### Methods inherited from class java.lang.Object

      `clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

    - ### Methods inherited from interface java.lang.Iterable

      `forEach, spliterator`

- - ### Constructor Detail

    - #### XdmExternalObject

          public XdmExternalObject​(java.lang.Object value)

      Create an XdmExternalObject that wraps a supplied Java object
      Parameters:
        `value` - the supplied Java object. Must not be null.
      Throws:
        `java.lang.NullPointerException` - if the supplied value is null.

  - ### Method Detail

    - #### getExternalObject

          public java.lang.Object getExternalObject()

      Get the wrapped Java object
      Returns:
        the wrapped object

    - #### toString

          public java.lang.String toString()

      Get the result of converting the external value to a string.
      Overrides:
        `toString` in class `XdmValue`
      Returns:
        the result of applying toString() to the wrapped external object.

    - #### equals

          public boolean equals​(java.lang.Object other)

      Compare two external objects for equality. Two instances of `XdmExternalObject` are equal if the Java objects that they wrap are equal.
      Overrides:
        `equals` in class `java.lang.Object`
      Parameters:
        `other` - the object to be compared
      Returns:
        true if the other object is an `XdmExternalObject` and the two wrapped objects are equal under the `equals()` method.

    - #### hashCode

          public int hashCode()

      Return a hash code for the object. This respects the semantics of `equals(Object)`;
      Overrides:
        `hashCode` in class `java.lang.Object`
      Returns:
        a suitable hash code