Package jnr.ffi.provider
Class DefaultObjectReferenceManager
java.lang.Object
jnr.ffi.ObjectReferenceManager
jnr.ffi.provider.DefaultObjectReferenceManager
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionAdds a mapping from a java object to a unique native address.Gets the java object that is mapped to the native memory address referred to byreference.booleanRemoves a mapping from java object to native pointer.Methods inherited from class jnr.ffi.ObjectReferenceManager
freeReference, getObject, newInstance, newReference
-
Constructor Details
-
DefaultObjectReferenceManager
-
-
Method Details
-
add
Description copied from class:ObjectReferenceManagerAdds a mapping from a java object to a unique native address. Each call to this method is guaranteed to produce a memory address unique within the ObjectReferenceManager instance, even for the same object.A strong reference to
objectis maintained internally, untilObjectReferenceManager.remove(Pointer)is called.- Specified by:
addin classObjectReferenceManager- Parameters:
obj- The java object to generate a reference for- Returns:
- A pointer representing the unique id.
-
remove
Description copied from class:ObjectReferenceManagerRemoves a mapping from java object to native pointer.- Specified by:
removein classObjectReferenceManager- Parameters:
reference- a native memory pointer.- Returns:
- true if the mapping was removed.
-
get
Description copied from class:ObjectReferenceManagerGets the java object that is mapped to the native memory address referred to byreference.- Specified by:
getin classObjectReferenceManager- Parameters:
reference- a native memory pointer.- Returns:
- The java object corresponding to
pointer.
-