Package org.fishbolt.common.adapter.ext

The Adapter Pattern Contains base implementation of the adapter mechanism.

See:
          Description

Interface Summary
IAdapterFactory The classes that implement the IAdapterFactory interface are responsible for creating adapters for adaptable objects.
 

Class Summary
Adaptable This is an abstract implementation of the adaptable object.
AdapterFactoryManager It contains the regisrty of Factories creating adapters.
SingleAdapterFactory Base implementation of the IAdapterFactory interface that can create an adapter of one type only.
 

Package org.fishbolt.common.adapter.ext Description

The Adapter Pattern

Contains base implementation of the adapter mechanism.

The Adaptable class has been designed as a base class for all adaptable objects. Adapters are saved in the internal regisrty of the adaptable object. When a request to some adapter is received, it is being searched in this list. If there is no such adapter, a new instance of the adapter is created.

Objects implementing the IAdapterFactory interface are responsible for creating adapters. To control Factories, a special class has been provided - 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.