org.python.modules._weakref

## Class GlobalRef

- java.lang.Object
- - java.lang.ref.Reference<T>
  - - java.lang.ref.WeakReference
    - - org.python.modules._weakref.GlobalRef

    public class GlobalRef
    extends java.lang.ref.WeakReference

### Constructor Summary

Constructors
Constructor and Description
`GlobalRef(PyObject object)`

### Method Summary

All Methods Static Methods Instance Methods Concrete Methods
`void` `add(AbstractReference ref)`
`int` `count()`
`boolean` `equals(java.lang.Object o)` Allow GlobalRef's to be used as hashtable keys.
`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.
`int` `hashCode()` Allows GlobalRef to be used as hashtable keys.
`static GlobalRef` `newInstance(PyObject object)` Create a new tracked GlobalRef.
`int` `pythonHashCode()` The publicly used hashCode, for the AbstractReference wrapper.
`PyList` `refs()`

### Methods inherited from class java.lang.ref.Reference

`clear, enqueue, get, isEnqueued`

### Methods inherited from class java.lang.Object

`getClass, notify, notifyAll, toString, wait, wait, wait`

### Constructor Detail

#### GlobalRef

    public GlobalRef(PyObject object)

### Method Detail

#### add

    public void add(AbstractReference ref)

#### count

    public int count()

#### refs

    public PyList refs()

#### newInstance

    public static GlobalRef newInstance(PyObject object)

Create a new tracked GlobalRef.

Parameters:
  `object` - a PyObject to reference
Returns:
  a new tracked GlobalRef

#### getCount

    public static int getCount(PyObject object)

Return the number of references to the specified PyObject.

Parameters:
  `object` - a PyObject
Returns:
  an int reference count

#### getRefs

    public static PyList getRefs(PyObject object)

Return a list of references to the specified PyObject.

Parameters:
  `object` - a PyObject
Returns:
  a PyList of references. may be empty

#### equals

    public boolean equals(java.lang.Object o)

Allow GlobalRef's to be used as hashtable keys.

Overrides:
  `equals` in class `java.lang.Object`

#### hashCode

    public int hashCode()

Allows GlobalRef to be used as hashtable keys.

Overrides:
  `hashCode` in class `java.lang.Object`
Returns:
  a hashCode int value

#### pythonHashCode

    public int pythonHashCode()

The publicly used hashCode, for the AbstractReference wrapper.

Returns:
  a hashCode int value