View Javadoc

1   /*
2    * @(#) StrongReference.java Dec 9, 2003
3    * 
4    * Copyright (c) 2003 Delft University of Technology Jaffalaan 5, 2628 BX Delft,
5    * the Netherlands All rights reserved.
6    * 
7    * This software is proprietary information of Delft University of Technology
8    * The code is published under the General Public License
9    */
10  package nl.tudelft.simulation.event.ref;
11  
12  import java.io.Serializable;
13  
14  /***
15   * A StrongReference class represents a normal pointer relation to a reference.
16   * This class is created to complete the java.lang.ref package. This class
17   * ensures that references can be used without casting to either an object or a
18   * reference. Strong references are not created to be cleaned by the garbage
19   * collector. Since they represent normal pointer relations, they are the only
20   * ones which might be serialized. This class therefore implements
21   * <code>java.io.Serializable</code>
22   * <p>
23   * (c) copyright 2003-2004 <a href="http://www.simulation.tudelft.nl">Delft
24   * University of Technology </a>, the Netherlands. <br>
25   * See for project information <a
26   * href="http://www.simulation.tudelft.nl">www.simulation.tudelft.nl </a> <br>
27   * License of use: <a href="http://www.gnu.org/copyleft/gpl.html">General Public
28   * License (GPL) </a>, no warranty <br>
29   * 
30   * @author <a href="http://www.simulation.tudelft.nl/people/jacobs.html">Peter
31   *         Jacobs </a>
32   * @version 1.0, 2004-03-18
33   * @since 1.0
34   */
35  public class StrongReference implements Reference, Serializable
36  {
37  	/*** the referent */
38  	private Object referent = null;
39  
40  	/***
41  	 * Creates a new strong reference that refers to the given object. The new
42  	 * reference is not registered with any queue.
43  	 * 
44  	 * @param referent object the new strong reference will refer to
45  	 */
46  	public StrongReference(final Object referent)
47  	{
48  		this.referent = referent;
49  	}
50  
51  	/***
52  	 * @see nl.tudelft.simulation.event.ref.Reference#get()
53  	 */
54  	public Object get()
55  	{
56  		return this.referent;
57  	}
58  }