Interface COM.ibm.jaws.mofw.IdentityDelegator
All Packages  Class Hierarchy  This Package  Previous  Next  Index

Interface COM.ibm.jaws.mofw.IdentityDelegator

public interface IdentityDelegator
extends Object
If methods in your object implementation would "normally" pass out a reference to itself ("this" in Java), you should signal this need to your manager by supporting IdentityDelegator. Implementing this interface allows the context in which your object is created to transparently add services to your object (like persistence and concurrency) through "delegation."

The benefit to you is that you need not have any code in your objects for any services other than those explicitly found in the MOFW interfaces, and it will maximize the market for your object implementation (as many BaseCollection implementations will rely on delegation).

Your responsibility is a simple one: In your constructor, initialize a field (which I will call self) to this. If setSelf is called, its parameter must override the current value self. Whenever you would pass out of your object this (via a return value or a parameter to another object) pass self instead.

If you never pass out a reference to yourself in a public method then you should not implement this interface to avoid unnecessary overhead.

Private methods on IdentityDelegator objects can still pass "this" as a return value as long as the "client" never hands out a reference to it. This scenario may lead to the need for a "duplicate" method in this interface (when a "private client" needs to hand a reference). However, in this case, the OP could have another private method of his or her choice, and there may never be a need to standardize on it.

The only case for standardization may be in "robustness" scenarios, where a given class has a reference that is *not* an instance of Identifiable it might check to see if the object is an instance of IdentityDelegator, in which case it could (standardly) ask for a "duplicate". If the returned object is *still* not Identifiable, then it could raise an exception...

In any event, if your object supports specialized constructors that may hand out references during initialization, you should add a "self" parameter to the signature.


Method Index

 o setSelf(Object)
Use this method to indicate the object that represents the external identity of the object.

Methods

 o setSelf
  public abstract void setSelf(Object self)
Use this method to indicate the object that represents the external identity of the object.
Parameters:
self - the object to which identity is delegated.

All Packages  Class Hierarchy  This Package  Previous  Next  Index