All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class uhr.core.role.DelegatorLib

java.lang.Object
   |
   +----uhr.core.role.DelegatorLib

public class DelegatorLib
extends Object
This contains handy static library methods related to Delegator.

See Also:
Delegator

Constructor Index

 o DelegatorLib()

Method Index

 o extractDelegate(String, Class, Object)
This method represents our policy for exposed delegation.

Constructors

 o DelegatorLib
 public DelegatorLib()

Methods

 o extractDelegate
 public static Object extractDelegate(String name,
                                      Class type,
                                      Object object)
This method represents our policy for exposed delegation. It returns the proper named delegate of the desired type from the object or null if no delegate or the object doesn't implement the type. This is designed to be used whenever a class that might implement Delegator is to be cast to an interface, because the class may have a delegate handling that interface. The algorithm is:
1. If the object implements Delegator and has a delegate for the name, return the delegate. If the delegate doesn't implement the type interface, an IllegalStateException is thrown since this is a programming bug. If the object doesn't have the delegate we got to the next step.

2. Otherwise if the object implements the type, the object is returned.

3. Otherwise the object doesn't support the interface implied by the type, and so null is returned.

Parameters:
name - the standard delegate name.
type - the class type of the delegate.
object - the object to use for extraction.
Returns:
the desired delegate of the type or null if none.

All Packages  Class Hierarchy  This Package  Previous  Next  Index