Package jadex.commons.collection
Class WeakObject<T>
- java.lang.Object
-
- java.lang.ref.Reference<T>
-
- java.lang.ref.WeakReference<T>
-
- jadex.commons.collection.WeakObject<T>
-
- Direct Known Subclasses:
WeakEntry
public class WeakObject<T> extends java.lang.ref.WeakReference<T>Weakreference has the disadvantage that it does not support transparent equals() and hashcode() methods. WeakObject provides this support.
-
-
Field Summary
Fields Modifier and Type Field Description protected inthashcodeThe hash code.
-
Constructor Summary
Constructors Constructor Description WeakObject(T object)Construct a new reference.WeakObject(T obj, java.lang.ref.ReferenceQueue<? super T> queue)Construct a
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(java.lang.Object object)Check the equality of an object with this.inthashCode()Return the hash code of the nested object.
-
-
-
Constructor Detail
-
WeakObject
public WeakObject(T object)
Construct a new reference.- Parameters:
object- Object to reference.
-
WeakObject
public WeakObject(T obj, java.lang.ref.ReferenceQueue<? super T> queue)
Construct a- Parameters:
obj- Object to reference.queue- Reference queue.
-
Method Detail
-
equals
public boolean equals(java.lang.Object object)
Check the equality of an object with this.- Overrides:
equalsin classjava.lang.Object- Parameters:
object- 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.
-
-
-