Class AbstractNativeProxy

java.lang.Object
com.exonum.binding.core.proxy.AbstractNativeProxy
Direct Known Subclasses:
AbstractAccess, AbstractCloseableNativeProxy, BlockchainData, EntryIndexProxy, KeySetIndexProxy, ListIndexProxy, MapIndexProxy, ProofEntryIndexProxy, ProofListIndexProxy, ProofMapIndexProxy, ValueSetIndexProxy

public abstract class AbstractNativeProxy
extends java.lang.Object
A base class of a native proxy.
  • Field Summary

    Fields 
    Modifier and Type Field Description
    protected NativeHandle nativeHandle
    A handle to the native object.
  • Constructor Summary

    Constructors 
    Modifier Constructor Description
    protected AbstractNativeProxy​(NativeHandle nativeHandle)  
  • Method Summary

    Modifier and Type Method Description
    protected long getNativeHandle()
    Returns a handle to the native object if it may be safely used to access the native object.
    protected boolean isValidHandle()
    Returns true if this proxy has a valid native handle.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

  • Constructor Details

  • Method Details

    • getNativeHandle

      protected long getNativeHandle()
      Returns a handle to the native object if it may be safely used to access the native object. Equivalent to nativeHandle.get().

      The returned value shall only be passed as an argument to native methods.

      Warning: do not cache the return value, as you won't be able to catch use-after-free.

      Throws:
      java.lang.IllegalStateException - if the native handle is invalid (closed or nullptr)
    • isValidHandle

      protected final boolean isValidHandle()
      Returns true if this proxy has a valid native handle.