1 |
/* java.lang.ref.SoftReference |
/* java.lang.ref.SoftReference |
2 |
Copyright (C) 1999 Free Software Foundation, Inc. |
Copyright (C) 1999, 2004 Free Software Foundation, Inc. |
3 |
|
|
4 |
This file is part of GNU Classpath. |
This file is part of GNU Classpath. |
5 |
|
|
47 |
* |
* |
48 |
* @author Jochen Hoenicke |
* @author Jochen Hoenicke |
49 |
*/ |
*/ |
50 |
public class SoftReference |
public class SoftReference<T> |
51 |
extends Reference |
extends Reference<T> |
52 |
{ |
{ |
53 |
/** |
/** |
54 |
* Create a new soft reference, that is not registered to any queue. |
* Create a new soft reference, that is not registered to any queue. |
55 |
* @param referent the object we refer to. |
* @param referent the object we refer to. |
56 |
*/ |
*/ |
57 |
public SoftReference(Object referent) |
public SoftReference(T referent) |
58 |
{ |
{ |
59 |
super(referent); |
super(referent); |
60 |
} |
} |
65 |
* @param q the reference queue to register on. |
* @param q the reference queue to register on. |
66 |
* @exception NullPointerException if q is null. |
* @exception NullPointerException if q is null. |
67 |
*/ |
*/ |
68 |
public SoftReference(Object referent, ReferenceQueue q) |
public SoftReference(T referent, ReferenceQueue<? super T> q) |
69 |
{ |
{ |
70 |
super(referent, q); |
super(referent, q); |
71 |
} |
} |
75 |
* @return the object, this reference refers to, or null if the |
* @return the object, this reference refers to, or null if the |
76 |
* reference was cleared. |
* reference was cleared. |
77 |
*/ |
*/ |
78 |
public Object get() |
public T get() |
79 |
{ |
{ |
80 |
/* Why is this overloaded??? |
/* Why is this overloaded??? |
81 |
* Maybe for a kind of LRU strategy. */ |
* Maybe for a kind of LRU strategy. */ |