org.fishbolt.common.adapter.ext
Class Adaptable

java.lang.Object
  extended by org.fishbolt.common.adapter.ext.Adaptable
All Implemented Interfaces:
IAdaptable

public abstract class Adaptable
extends java.lang.Object
implements IAdaptable

This is an abstract implementation of the adaptable object. It contains the java.util.Map regisrty for instances of adapters. Every instance from this list is associated with its type in this list.


Constructor Summary
Adaptable()
           
 
Method Summary
<A extends IAdapter>
A
getAdapter(java.lang.Class<A> adapterType)
          The method parameter sets a type of the adapter, which instance we want to get.
protected abstract  AdapterFactoryManager getAdapterFactoryManager()
          Able to provide an instance of the AdapterFactoryManager class.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Adaptable

public Adaptable()
Method Detail

getAdapter

public <A extends IAdapter> A getAdapter(java.lang.Class<A> adapterType)
Description copied from interface: IAdaptable
The method parameter sets a type of the adapter, which instance we want to get. As we can see from the method declaration, there can be only one adapter of the declared type for every adaptable object.

Therefore, if it is necessary to bind several objects of the same type and an adaptable object, its adapter has to "wrap up" all these the same-type objects in it and provide access to them.

Specified by:
getAdapter in interface IAdaptable
Type Parameters:
A - type of the adapter, which instance we want to get.
Parameters:
adapterType - type of the adapter, which instance we want to get.
Returns:
Adapter instance bounded to the adaptable object.
See Also:
IAdapter

getAdapterFactoryManager

protected abstract AdapterFactoryManager getAdapterFactoryManager()
Able to provide an instance of the AdapterFactoryManager class.AdapterFactoryManager.

Returns:
instance of the AdapterFactoryManager class.AdapterFactoryManager
See Also:
AdapterFactoryManager