| java.lang.Object org.apache.tapestry.ioc.util.StrategyRegistry
StrategyRegistry | final public class StrategyRegistry (Code) | | A key component in implementing the "Gang of Four" Strategy pattern. A StrategyRegistry will
match up a given input type with a registered strategy for that type.
< Parameters: A - >the type of the strategy adapter |
Constructor Summary | |
public | StrategyRegistry(Class<A> adapterType, Map<Class, A> registrations) Creates a strategy registry for the given adapter type. |
StrategyRegistry | public StrategyRegistry(Class<A> adapterType, Map<Class, A> registrations)(Code) | | Creates a strategy registry for the given adapter type.
Parameters: adapterType - the type of adapter retrieved from the registry Parameters: registrations - map of registrations (the contents of the map are copied) |
clearCache | public void clearCache()(Code) | | |
get | public A get(Class type)(Code) | | Searches for an adapter corresponding to the given input type.
Parameters: type - the type to search the corresponding adapter throws: IllegalArgumentException - if no matching adapter may be found |
getByInstance | public A getByInstance(Object value)(Code) | | Gets an adapter for an object. Searches based on the value's class, unless the value is null,
in which case, a search on class void is used.
Parameters: value - for which an adapter is needed the adaptoer for the value throws: IllegalArgumentException - if no matching adapter may be found |
|
|