|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.fishbolt.common.adapter.ext.AdapterFactoryManager
public class AdapterFactoryManager
It contains the regisrty of Factories creating adapters.
In the context of one system the AdapterFactoryManager
object generally exists as a single instance.
All Adaptable objects address to it in
the case if the necessary adapter instance is absent
in their regisrty. The AdapterFactoryManager object finds
the Factory that is responsible for creation of the adapter
with the required type and delegates its creation to this Factory.
The newly created object is added to the regisrty
of the adaptable object.
| Field Summary | |
|---|---|
protected java.util.LinkedHashMap<java.lang.Class<? extends IAdapter>,java.util.LinkedHashSet<IAdapterFactory>> |
adapterFactories
regisrty of objects implementing the IAdapterFactory interface. |
| Constructor Summary | |
|---|---|
AdapterFactoryManager()
|
|
| Method Summary | ||
|---|---|---|
protected
|
createAdapter(java.lang.Class<A> adapterType,
IAdaptable adaptable)
Delegates creation of the concrete adapter for the adaptable object to the corresponding Factory instance from the Factories saved in the regisrty |
|
protected static java.lang.Class<? extends IAdapter> |
getDerivedFrom(java.lang.Class<? extends IAdapter> base,
java.util.Set<java.lang.Class<? extends IAdapter>> derived)
Determines first class or interface from the set derived
which is either the same as class, or is a subclass or
subinterface of, the class or interface represented by the specified
base parameter |
|
void |
register(IAdapterFactory factory)
Supports possibility to include a new Factory object into the regisrty. |
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected java.util.LinkedHashMap<java.lang.Class<? extends IAdapter>,java.util.LinkedHashSet<IAdapterFactory>> adapterFactories
IAdapterFactory interface.
| Constructor Detail |
|---|
public AdapterFactoryManager()
| Method Detail |
|---|
public void register(IAdapterFactory factory)
factory - adapter factoryIAdapterFactory
protected <A extends IAdapter> A createAdapter(java.lang.Class<A> adapterType,
IAdaptable adaptable)
A - adapter being created.adapterType - adapter type.adaptable - adaptable object to create adapter for.
null.IAdapter,
IAdaptable
protected static java.lang.Class<? extends IAdapter> getDerivedFrom(java.lang.Class<? extends IAdapter> base,
java.util.Set<java.lang.Class<? extends IAdapter>> derived)
derived
which is either the same as class, or is a subclass or
subinterface of, the class or interface represented by the specified
base parameter
base - defines instance of class to look for.derived - set of classes to look in.
null.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||