Package org.python.modules._weakref
Class GlobalRef
- All Implemented Interfaces:
ReferenceBackend
-
Field Summary
Modifier and TypeFieldDescriptionstatic ReferenceBackendFactory
This is a hook for JyNI to insert a native-objects-aware implementation of ReferenceBackend. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
add
(AbstractReference ref) int
count()
boolean
AllowGlobalRef
s to be used as hashtable-keys.Search for a reusable reference.static int
Return the number of references to the specifiedPyObject
.static PyList
Return a list of references to the specifiedPyObject
.static boolean
int
hashCode()
AllowsGlobalRef
to be used as hashtable-keys.boolean
static ReferenceBackend
newInstance
(PyObject object) Create a new trackedReferenceBackend
.static void
Call all callbacks that were enqueued viadelayedCallback(GlobalRef)
method.int
The publicly usedhashCode
, for theAbstractReference
wrapper.refs()
void
Restores this weak reference to its former referent.Methods inherited from class java.lang.ref.Reference
clear, enqueue, get, isEnqueued, reachabilityFence, refersTo
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.python.modules._weakref.ReferenceBackend
get
-
Field Details
-
factory
This is a hook for JyNI to insert a native-objects-aware implementation of ReferenceBackend.
-
-
Constructor Details
-
GlobalRef
-
-
Method Details
-
add
- Specified by:
add
in interfaceReferenceBackend
-
find
Search for a reusable reference. To be reused, it must be of the same class and it must not have a callback.- Specified by:
find
in interfaceReferenceBackend
-
processDelayedCallbacks
public static void processDelayedCallbacks()Call all callbacks that were enqueued viadelayedCallback(GlobalRef)
method.- See Also:
-
delayedCallback(GlobalRef)
-
hasDelayedCallbacks
public static boolean hasDelayedCallbacks() -
isCleared
public boolean isCleared()- Specified by:
isCleared
in interfaceReferenceBackend
-
count
public int count()- Specified by:
count
in interfaceReferenceBackend
-
refs
- Specified by:
refs
in interfaceReferenceBackend
-
newInstance
Create a new trackedReferenceBackend
. If noReferenceBackendFactory
is registered, it actually returns aGlobalRef
.- Parameters:
object
- aPyObject
to reference- Returns:
- a new tracked
ReferenceBackend
-
restore
Restores this weak reference to its former referent. This actually means that a freshGlobalRef
is created and inserted into all adjacentAbstractReference
s. The currentGlobalRef
is disbanded. If the givenPyObject
is not the former referent of this weak reference, anIllegalArgumentException
is thrown.- Specified by:
restore
in interfaceReferenceBackend
- Throws:
IllegalArgumentException
- ifformerReferent
is not the actual former referent.
-
getCount
Return the number of references to the specifiedPyObject
.- Parameters:
object
- a PyObject- Returns:
- an int reference count
-
getRefs
Return a list of references to the specifiedPyObject
. -
equals
AllowGlobalRef
s to be used as hashtable-keys. -
hashCode
public int hashCode()AllowsGlobalRef
to be used as hashtable-keys. -
pythonHashCode
public int pythonHashCode()The publicly usedhashCode
, for theAbstractReference
wrapper.- Specified by:
pythonHashCode
in interfaceReferenceBackend
- Returns:
- a hashCode
int
-value
-