|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
A base interface allowing (but not requiring) this object to serve as a delegate for some other delegator. Typically used by delegates providing a "navigable" service for its delegator. A navigable service is one that provides access to other instances of a service, such as nodes in a data tree. In such a case a delegator is interested in accessing other delegators, not the delegate service instances.
If a delegator wants to replace a delegate it simply replaces the old delegate reference with the new one. Assuming that only the delegator references the old delegate there is no need to "dispose" the delegate. This may not be the case for navigational delegates, however. To assure that a delegate will be disposed it can implement Disposable.
In situations where delegation may be nested it is left to the implementor to decide, and the documention to describe, whether the delegator returned by getDelegator() is the immediate delegator (as in a delegation chain) or some "ultimate" delegator (the root delegator in a chain, or some other object outside the chain).
Method Summary | |
java.lang.Object |
getDelegator()
Gets the delegator of this delegate, as set by initDelegator(). |
Delegatable |
initDelegator(java.lang.Object delegator)
Used by delegators and serialization to initialize this delegate's delegator reference. |
boolean |
isDelegatorInited()
Returns true if initDelegator() has been called and the initialization is still valid; otherwise, returns false. |
Method Detail |
public Delegatable initDelegator(java.lang.Object delegator)
delegator
- Reference to the delegator. If self-delegation
is allowed and the delegator is null, this object is the delegator
(which facilitates inline construction).
java.lang.IllegalStateException
- Delegator is different from the
initial one.public boolean isDelegatorInited()
public java.lang.Object getDelegator()
java.lang.IllegalStateException
- Must first call initDelegator(), or
initialization is no longer valid.
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |