|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.tapestry5.ioc.util.StrategyRegistry<A>
A
- the type of the strategy adapterpublic final class StrategyRegistry<A>
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.
Method Summary | ||
---|---|---|
void |
clearCache()
|
|
A |
get(Class type)
Searches for an adapter corresponding to the given input type. |
|
Class<A> |
getAdapterType()
|
|
A |
getByInstance(Object value)
Gets an adapter for an object. |
|
Collection<Class> |
getTypes()
Returns the registered types for which adapters are available. |
|
static
|
newInstance(Class<A> adapterType,
Map<Class,A> registrations)
Creates a strategy registry for the given adapter type. |
|
static
|
newInstance(Class<A> adapterType,
Map<Class,A> registrations,
boolean allowNonMatch)
Creates a strategy registry for the given adapter type. |
|
String |
toString()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Method Detail |
---|
public static <A> StrategyRegistry<A> newInstance(Class<A> adapterType, Map<Class,A> registrations)
adapterType
- the type of adapter retrieved from the registryregistrations
- map of registrations (the contents of the map are copied)public static <A> StrategyRegistry<A> newInstance(Class<A> adapterType, Map<Class,A> registrations, boolean allowNonMatch)
adapterType
- the type of adapter retrieved from the registryregistrations
- map of registrations (the contents of the map are copied)allowNonMatch
- if true, then the registry supports non-matches when retrieving an adapterpublic void clearCache()
public Class<A> getAdapterType()
public A getByInstance(Object value)
value
- for which an adapter is needed
IllegalArgumentException
- if no matching adapter may be found and allowNonMatch is falsepublic A get(Class type)
type
- the type to search
IllegalArgumentException
- if no matching adapter may be found and allowNonMatch is falsepublic Collection<Class> getTypes()
public String toString()
toString
in class Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |