public class GlobalRef extends WeakReference<PyObject> implements ReferenceBackend
| Modifier and Type | Field and Description |
|---|---|
static ReferenceBackendFactory |
factory
This is a hook for JyNI to insert a native-objects-aware implementation
of ReferenceBackend.
|
| Modifier and Type | Method and Description |
|---|---|
void |
add(AbstractReference ref) |
int |
count() |
boolean |
equals(Object o)
Allow
GlobalRefs to be used as hashtable-keys. |
AbstractReference |
find(Class<?> cls)
Search for a reusable reference.
|
static int |
getCount(PyObject object)
Return the number of references to the specified
PyObject. |
static PyList |
getRefs(PyObject object)
Return a list of references to the specified
PyObject. |
static boolean |
hasDelayedCallbacks() |
int |
hashCode()
Allows
GlobalRef to be used as hashtable-keys. |
boolean |
isCleared() |
static ReferenceBackend |
newInstance(PyObject object)
Create a new tracked
ReferenceBackend. |
static void |
processDelayedCallbacks()
Call all callbacks that were enqueued via
delayedCallback(GlobalRef) method. |
int |
pythonHashCode()
The publicly used
hashCode, for the
{@link org.python.modules. |
PyList |
refs() |
void |
restore(PyObject formerReferent)
Restores this weak reference to its former referent.
|
clear, enqueue, get, isEnqueuedgetClass, notify, notifyAll, toString, wait, wait, waitgetpublic static ReferenceBackendFactory factory
public GlobalRef(PyObject object)
public void add(AbstractReference ref)
add in interface ReferenceBackendpublic AbstractReference find(Class<?> cls)
find in interface ReferenceBackendpublic static void processDelayedCallbacks()
delayedCallback(GlobalRef) method.delayedCallback(GlobalRef)public static boolean hasDelayedCallbacks()
public boolean isCleared()
isCleared in interface ReferenceBackendpublic int count()
count in interface ReferenceBackendpublic PyList refs()
refs in interface ReferenceBackendpublic static ReferenceBackend newInstance(PyObject object)
ReferenceBackend.
If no ReferenceBackendFactory is registered, it actually
returns a GlobalRef.object - a PyObject to referenceReferenceBackendpublic void restore(PyObject formerReferent)
GlobalRef is created
and inserted into all adjacent
AbstractReferences. The
current GlobalRef is disbanded.
If the given PyObject is not the former
referent of this weak reference, an
IllegalArgumentException is thrown.restore in interface ReferenceBackendIllegalArgumentException - if formerReferent is not
the actual former referent.public static int getCount(PyObject object)
PyObject.object - a PyObjectpublic static PyList getRefs(PyObject object)
PyObject.public boolean equals(Object o)
GlobalRefs to be used as hashtable-keys.public int hashCode()
GlobalRef to be used as hashtable-keys.public int pythonHashCode()
hashCode, for the
AbstractReference
wrapper.pythonHashCode in interface ReferenceBackendint-value