Package org.djutils.event.reference
Class WeakReference<T extends Serializable>
- java.lang.Object
 - 
- org.djutils.event.reference.Reference<T>
 - 
- org.djutils.event.reference.WeakReference<T>
 
 
 
- 
- Type Parameters:
 T- the type of the reference
- All Implemented Interfaces:
 Serializable
public class WeakReference<T extends Serializable> extends Reference<T>
A WeakReference. The WeakReference extends thejava.lang.ref.WeakReferenceand besides implementing the Reference interface no changes are defined.Copyright (c) 2002-2023 Delft University of Technology, Jaffalaan 5, 2628 BX Delft, the Netherlands. All rights reserved. See for project information https://djutils.org. The DJUTILS project is distributed under a three-clause BSD-style license, which can be found at https://djutils.org/docs/license.html. This class was originally part of the DSOL project, see https://simulation.tudelft.nl/dsol/manual.
- Author:
 - Peter Jacobs , Alexander Verbraeck
 - See Also:
 - Serialized Form
 
 
- 
- 
Constructor Summary
Constructors Constructor Description WeakReference(T referent)Creates a new weak reference that refers to the given object. 
 - 
 
- 
- 
Constructor Detail
- 
WeakReference
public WeakReference(T referent)
Creates a new weak reference that refers to the given object. The new reference is not registered with any queue.- Parameters:
 referent- T; object the new weak reference will refer to
 
 - 
 
- 
Method Detail
- 
get
public final T get()
Returns this reference object's referent. If this reference object has been cleared, either by the program or by the garbage collector, then this method returnsnull.- Specified by:
 getin classReference<T extends Serializable>- Returns:
 - The object to which this reference refers, or 
nullif this reference object has been cleared. 
 
 - 
 
 -