Package org.jboss.util
Class WeakObject
- java.lang.Object
-
- java.lang.ref.Reference<T>
-
- java.lang.ref.WeakReference
-
- org.jboss.util.WeakObject
-
public final class WeakObject extends java.lang.ref.WeakReferenceConvenience class to wrap an Object into a WeakReference.Modified from java.util.WeakHashMap.WeakKey.
- Version:
- $Revision$
-
-
Field Summary
Fields Modifier and Type Field Description protected inthashCodeThe hash code of the nested object
-
Constructor Summary
Constructors Constructor Description WeakObject(java.lang.Object obj)Construct a WeakObject.WeakObject(java.lang.Object obj, java.lang.ref.ReferenceQueue queue)Construct a WeakObject.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static WeakObjectcreate(java.lang.Object obj)Create a WeakObject for the given object.static WeakObjectcreate(java.lang.Object obj, java.lang.ref.ReferenceQueue queue)Create a WeakObject for the given object.booleanequals(java.lang.Object obj)Check the equality of an object with this.inthashCode()Return the hash code of the nested object.
-
-
-
Constructor Detail
-
WeakObject
public WeakObject(java.lang.Object obj)
Construct a WeakObject.- Parameters:
obj- Object to reference.
-
WeakObject
public WeakObject(java.lang.Object obj, java.lang.ref.ReferenceQueue queue)Construct a WeakObject.- Parameters:
obj- Object to reference.queue- Reference queue.
-
-
Method Detail
-
equals
public boolean equals(java.lang.Object obj)
Check the equality of an object with this.- Overrides:
equalsin classjava.lang.Object- Parameters:
obj- Object to test equality with.- Returns:
- True if object is equal.
-
hashCode
public int hashCode()
Return the hash code of the nested object.- Overrides:
hashCodein classjava.lang.Object- Returns:
- The hash code of the nested object.
-
create
public static WeakObject create(java.lang.Object obj)
Create a WeakObject for the given object.- Parameters:
obj- Object to reference.- Returns:
- WeakObject or null if object is null.
-
create
public static WeakObject create(java.lang.Object obj, java.lang.ref.ReferenceQueue queue)
Create a WeakObject for the given object.- Parameters:
obj- Object to reference.queue- Reference queue.- Returns:
- WeakObject or null if object is null.
-
-