Class Native

java.lang.Object
com.surrealdb.Native
Direct Known Subclasses:
Array, Entry, EntryIterator, EntryMut, FileRef, Geometry, Id, Object, RecordId, Response, Surreal, Transaction, Value, ValueIterator, ValueMut

public abstract class Native extends Object
Base for types backed by a native pointer. Each instance owns its native object: the native side clones a shared reference or copies the data when it creates the instance, so it stays valid on its own, independently of the Value or connection it was obtained from. The native object is freed when the instance is garbage collected.
  • Method Details

    • close

      public void close()
      Releases the native resources held by this instance right away, instead of when it is garbage collected. For a Surreal, this also closes its connection. Calling it more than once is safe. After this call, using the instance throws a NullPointerException.

      Instances obtained from this one (a value taken from a Response, an element of an Array, a field of an Object, an entry's value, and so on) are not affected: each holds its own reference to the data, which is freed once every holder is closed or collected.

    • equals

      public final boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public final int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public final String toString()
      Overrides:
      toString in class Object