nl.tudelft.simulation.event.ref
Class StrongReference<T>

java.lang.Object
  extended by nl.tudelft.simulation.event.ref.Reference<T>
      extended by nl.tudelft.simulation.event.ref.StrongReference<T>
Type Parameters:
T - the type of the reference
All Implemented Interfaces:
java.io.Serializable

public class StrongReference<T>
extends Reference<T>

A StrongReference class represents a normal pointer relation to a reference. This class is created to complete the java.lang.ref package. This class ensures that references can be used without casting to either an object or a reference. Strong references are not created to be cleaned by the garbage collector. Since they represent normal pointer relations, they are the only ones which might be serialized. This class therefore implements java.io.Serializable

(c) copyright 2002-2005 Delft University of Technology , the Netherlands.

See for project information www.simulation.tudelft.nl/event
License of use: Lesser General Public License (LGPL) , no warranty

Since:
1.5
Version:
$Revision: 1.8 $ $Date: 2005/08/04 12:08:33 $
Author:
Peter Jacobs
See Also:
Serialized Form

Constructor Summary
StrongReference(T referent)
          Creates a new strong reference that refers to the given object.
 
Method Summary
 T get()
          Returns this reference object's referent.
protected  void set(T value)
          sets the value of the reference
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StrongReference

public StrongReference(T referent)
Creates a new strong reference that refers to the given object. The new reference is not registered with any queue.

Parameters:
referent - object the new strong reference will refer to
Method Detail

get

public T get()
Description copied from class: Reference
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 returns null.

Specified by:
get in class Reference<T>
Returns:
The object to which this reference refers, or null if this reference object has been cleared
See Also:
Reference.get()

set

protected void set(T value)
Description copied from class: Reference
sets the value of the reference

Specified by:
set in class Reference<T>
Parameters:
value - the value to set
See Also:
Reference.set(java.lang.Object)


Copyright © 2002-2005 Delft University of Technology, the Netherlands. All Rights Reserved.