T
- The type of the related Java object, if any.public abstract class NativeRef<T> extends Object
Constructor and Description |
---|
NativeRef()
Constructs a native reference.
|
Modifier and Type | Method and Description |
---|---|
protected void |
finalize() |
boolean |
hasNonZeroPointer()
Tests whether this reference has a non-zero native pointer.
|
void |
initialize(T ref)
Initializes a native reference with the specified Java object.
|
protected abstract long |
nativeInitialize(T ref)
Initializes a native pointer related to the specified Java object.
|
protected abstract void |
nativeRelease(T ref,
long ptr)
Releases the Java reference, if any, and the managed native pointer, if any.
|
void |
release()
Releases the managed Java reference, if any, and frees the managed native pointer,
if any, including freeing any natively allocated memory.
|
protected abstract long nativeInitialize(T ref)
ref
- the related Java object, or null
if there is none.protected abstract void nativeRelease(T ref, long ptr)
ref
- the Java object reference, or null
if there is none.ptr
- the native pointer, if any.public void initialize(T ref)
ref
- the Java object, or null
if none is required.public void release()
public boolean hasNonZeroPointer()
true
if the pointer is non-zero, false
if it is NULL
.