|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.fishbolt.common.adapter.ext.SingleAdapterFactory
public class SingleAdapterFactory
Base implementation of the IAdapterFactory
interface that can create an adapter of one type only.
| Field Summary | |
|---|---|
protected java.util.LinkedHashSet<java.lang.Class<?>> |
adaptableTypes
types of adaptable objects. |
protected java.lang.Class<? extends IAdapter> |
adpterClass
adapter class |
| Constructor Summary | |
|---|---|
SingleAdapterFactory(java.lang.Class<? extends IAdapter> adpterClass)
The constructor of the Factory creating adapters with the required type for any adaptable object |
|
SingleAdapterFactory(java.lang.Class<? extends IAdapter> adpterClass,
java.lang.Class<? extends IAdaptable>... adaptableTypes)
The constructor of the Factory creating adapters with the type, declared in the first parameter. |
|
| Method Summary | ||
|---|---|---|
|
create(java.lang.Class<A> adapterType,
IAdaptable adaptable)
In fact performs the creation of an adapter instance for the adaptable object. |
|
java.lang.Class<? extends IAdapter>[] |
getAdapterClasses()
Declares the types of adapters, which instances can be created by the Factory. |
|
protected
|
instantiate(java.lang.Class<A> adapterType,
IAdaptable adaptable)
Defines creation of an object instance itself is provided by calling the newInstance() method for the adapter class defined in the constructor. |
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected java.lang.Class<? extends IAdapter> adpterClass
protected java.util.LinkedHashSet<java.lang.Class<?>> adaptableTypes
| Constructor Detail |
|---|
public SingleAdapterFactory(java.lang.Class<? extends IAdapter> adpterClass)
adpterClass - - required adapter type.instantiate(Class, IAdaptable),
IAdapter
public SingleAdapterFactory(java.lang.Class<? extends IAdapter> adpterClass,
java.lang.Class<? extends IAdaptable>... adaptableTypes)
adpterClass - required adapter type.adaptableTypes - defines adaptable types to allow adapter creation forinstantiate(Class, IAdaptable),
IAdapter,
IAdaptable| Method Detail |
|---|
public java.lang.Class<? extends IAdapter>[] getAdapterClasses()
IAdapterFactory
getAdapterClasses in interface IAdapterFactoryIAdapter
public <A extends IAdapter> A create(java.lang.Class<A> adapterType,
IAdaptable adaptable)
IAdapterFactorynull.
create in interface IAdapterFactoryA - declares a type of the required adapteradapterType - defines a type of the required adapteradaptable - object for which the current adapter is being created.
null.IAdapter,
IAdaptable
protected <A extends IAdapter> A instantiate(java.lang.Class<A> adapterType,
IAdaptable adaptable)
newInstance() method for the adapter class defined in the constructor.
So, it is necessary to be able to create adapter instances using
another way: we should override the method.
A - adapter typeadapterType - adapter typeadaptable - to create adapter for
java.lang.RuntimeException - when it's impossible to instantiate adapter.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||