net.sf.molae.pipe.basic
Class ObjectProxy<B>

java.lang.Object
  extended by net.sf.molae.pipe.basic.ObjectProxy<B>
Direct Known Subclasses:
CollectionProxy, InverseTransformer, KeyFilter, MapProxy, Not, ObjectUnion, PredicateProxy, TransformListIterator

public class ObjectProxy<B>
extends Object

Delegates all method calls to another object. Useful base class for proxies and other wrappers.


Constructor Summary
ObjectProxy(B base)
          Constructs a new proxy of the specified object.
 
Method Summary
static void assertNotNull(Object o)
          Checks if the specified object is null.
 boolean equals(Object o)
          Indicates whether some other object is "equal to" this one.
protected  B getBase()
          Returns the underlying base object.
 int hashCode()
          Returns a hash code value for the object.
 String toString()
          Returns a string representation of the object.
static String toVerboseString(Object wrapper, Object base)
          Generates a string that contains the class of the wrapper and the string of the base object.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ObjectProxy

public ObjectProxy(B base)
Constructs a new proxy of the specified object.

Parameters:
base - the underlying object.
Throws:
NullPointerException - if the specified object is null.
Method Detail

getBase

protected final B getBase()
Returns the underlying base object.

Returns:
the underlying base object

hashCode

public int hashCode()
Returns a hash code value for the object. This implementation returns the hash code of the base object.

Overrides:
hashCode in class Object
Returns:
a hash code value for the object

equals

public boolean equals(Object o)
Indicates whether some other object is "equal to" this one. This implementation checks three conditions:
  1. The object is not null.
  2. The classes of this and the other object are equal.
  3. The base objects are equal.

Overrides:
equals in class Object
Parameters:
o - the reference object with which to compare
Returns:
true if this object equals the specified object.

toString

public String toString()
Returns a string representation of the object. This implementation returns the string representation of the base object.

Overrides:
toString in class Object
Returns:
a string representation of the object.

assertNotNull

public static void assertNotNull(Object o)
Checks if the specified object is null.

Parameters:
o - the object that must not be null
Throws:
NullPointerException - if the specified object is null.

toVerboseString

public static String toVerboseString(Object wrapper,
                                     Object base)
Generates a string that contains the class of the wrapper and the string of the base object.

Parameters:
wrapper - a wrapper object
base - the base of the wrapper object
Returns:
a string representation of the wrapper object
Throws:
NullPointerException - if the specified wrapper is null.