public abstract class Reference<T> extends Object
| Modifier and Type | Method and Description | 
|---|---|
| void | clear()Clears this reference object. | 
| protected Object | clone()Throws  CloneNotSupportedException. | 
| boolean | enqueue()Clears this reference object and adds it to the queue with which
 it is registered, if any. | 
| T | get()Returns this reference object's referent. | 
| boolean | isEnqueued()Tells whether or not this reference object has been enqueued, either by
 the program or by the garbage collector. | 
public T get()
null.null if this reference object has been clearedpublic void clear()
This method is invoked only by Java code; when the garbage collector clears references it does so directly, without invoking this method.
public boolean isEnqueued()
false.true if and only if this reference object has
           been enqueuedpublic boolean enqueue()
This method is invoked only by Java code; when the garbage collector enqueues references it does so directly, without invoking this method.
true if this reference object was successfully
           enqueued; false if it was already enqueued or if
           it was not registered with a queue when it was createdprotected Object clone() throws CloneNotSupportedException
CloneNotSupportedException. A Reference cannot be
 meaningfully cloned. Construct a new Reference instead.clone in class ObjectCloneNotSupportedException - alwaysCloneable Submit a bug or feature 
For further API reference and developer documentation, see Java SE Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.
 Copyright © 1993, 2025, Oracle and/or its affiliates.  All rights reserved. Use is subject to license terms. Also see the documentation redistribution policy.