gumbo.util
Class Delegatables.DelegatableWrapper

java.lang.Object
  |
  +--gumbo.util.Delegatables.DelegatableWrapper
All Implemented Interfaces:
Delegatable, java.io.Serializable
Direct Known Subclasses:
Relations.RelationWrapper
Enclosing class:
Delegatables

public static class Delegatables.DelegatableWrapper
extends java.lang.Object
implements Delegatable, java.io.Serializable

A serializable wrapper for a target Delegatable. All accessors, including identity, forward to the target.

See Also:
Serialized Form

Constructor Summary
Delegatables.DelegatableWrapper(Delegatable target)
           
 
Method Summary
 java.lang.Object getDelegator()
          Gets the delegator of this delegate, as set by initDelegator().
 Delegatable initDelegator(java.lang.Object delegator)
          Returns this wrapper, not the target.
 boolean isDelegatorInited()
          Returns true if initDelegator() has been called and the initialization is still valid; otherwise, returns false.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Delegatables.DelegatableWrapper

public Delegatables.DelegatableWrapper(Delegatable target)
Parameters:
target - Wrapped target. Never null.
Method Detail

initDelegator

public Delegatable initDelegator(java.lang.Object delegator)
Returns this wrapper, not the target.

Specified by:
initDelegator in interface Delegatable
Parameters:
delegator - Reference to the delegator. If self-delegation is allowed and the delegator is null, this object is the delegator (which facilitates inline construction).
Returns:
Reference to this delegatable (which facilitates inline construction).

isDelegatorInited

public boolean isDelegatorInited()
Description copied from interface: Delegatable
Returns true if initDelegator() has been called and the initialization is still valid; otherwise, returns false.

Specified by:
isDelegatorInited in interface Delegatable
Returns:
The result.

getDelegator

public java.lang.Object getDelegator()
Description copied from interface: Delegatable
Gets the delegator of this delegate, as set by initDelegator(). Throws an exception if isDelegatorInited() is false.

Specified by:
getDelegator in interface Delegatable
Returns:
Reference to the delegator. Possibly this delegate (self delegation) but never null.