Package com.exonum.binding.proxy
Class AbstractNativeProxy
- java.lang.Object
-
- com.exonum.binding.proxy.AbstractNativeProxy
-
- Direct Known Subclasses:
AbstractCloseableNativeProxy
,EntryIndexProxy
,KeySetIndexProxy
,ListIndexProxy
,MapIndexProxy
,ProofListIndexProxy
,ProofMapIndexProxy
,ValueSetIndexProxy
,View
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
All Methods Instance Methods Concrete Methods 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.
-
-
-
Field Detail
-
nativeHandle
protected final NativeHandle nativeHandle
A handle to the native object.
-
-
Constructor Detail
-
AbstractNativeProxy
protected AbstractNativeProxy(NativeHandle nativeHandle)
-
-
Method Detail
-
getNativeHandle
protected long getNativeHandle()
Returns a handle to the native object if it may be safely used to access the native object. Equivalent tonativeHandle.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.
-
-