javautils.holders
Class AbstractHolder

java.lang.Object
  |
  +--javautils.holders.AbstractHolder
All Implemented Interfaces:
java.lang.Cloneable, java.io.Serializable
Direct Known Subclasses:
BooleanHolder, ByteHolder, CharHolder, DoubleHolder, FloatHolder, IntHolder, LongHolder, ShortHolder

public abstract class AbstractHolder
extends java.lang.Object
implements java.lang.Cloneable, java.io.Serializable

A base class for holders providing default implementations of equals(java.lang.Object), hashCode() and toString()-methods.

Note: The derived holder class is assumed to contain a public field named value.

See Also:
Serialized Form

Constructor Summary
AbstractHolder()
           
 
Method Summary
 boolean equals(java.lang.Object other)
           
protected  java.lang.Object get()
          Gets the value of the value-field of this object.
 int hashCode()
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

AbstractHolder

public AbstractHolder()
Method Detail

get

protected java.lang.Object get()

Gets the value of the value-field of this object. You can override this method in the derived class to improve performance, but it is not strictly necessary.

Node: This method is not intended for public use. The whole idea is that concrete holders publicly reveal their value-field for ease of use.


equals

public boolean equals(java.lang.Object other)
Overrides:
equals in class java.lang.Object

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object