|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.perfectjpattern.core.structural.AbstractSurrogate<T,A> org.perfectjpattern.core.structural.adapter.Adapter<T,A>
T
- Target
element typeA
- Adaptee
element typepublic class Adapter<T,A>
Concrete implementation of IAdapter
Constructor Summary | |
---|---|
Adapter(Class<T> anInterface,
A anAdaptee)
Constructs an Adapter instance having the target interface, the
adaptee instance and assigning the default adapting strategy |
|
Adapter(Class<T> aTargetInterface,
A anAdaptee,
IAdaptingStrategy anAdaptingStrategy)
Constructs an Adapter taking as input the Target
interface type, an Adaptee instance and the
IAdaptingStrategy for matching those interfaces. |
Method Summary | |
---|---|
A |
getAdaptee()
Returns the Adaptee instance |
T |
getTarget()
Returns the Target instance |
protected Object |
invokeUnderlying(Method aMethod,
Object[] anArguments)
Returns the result of the Method invocation. |
void |
setAdaptingStrategy(IAdaptingStrategy anAdaptingStrategy)
Sets the adapting strategy e.g. |
Methods inherited from class org.perfectjpattern.core.structural.AbstractSurrogate |
---|
equals, getComponent, getComponentClass, getUnderlying, hashCode, invoke |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface org.perfectjpattern.core.api.structural.ISurrogate |
---|
getComponent |
Methods inherited from interface java.lang.reflect.InvocationHandler |
---|
invoke |
Constructor Detail |
---|
public Adapter(Class<T> aTargetInterface, A anAdaptee, IAdaptingStrategy anAdaptingStrategy) throws IllegalArgumentException
Adapter
taking as input the Target
interface type, an Adaptee
instance and the
IAdaptingStrategy
for matching those interfaces.
aTargetInterface
- Target interface class typeanAdaptee
- Adaptee instanceanAdaptingStrategy
- Strategy for matching the Target and Adaptee
interfaces
IllegalArgumentException
- 'aTargetInterface' must not be null
IllegalArgumentException
- 'anAdaptee' must not be null
IllegalArgumentException
- 'anAdaptingStrategy' must not be nullpublic Adapter(Class<T> anInterface, A anAdaptee) throws IllegalArgumentException
Adapter
instance having the target interface, the
adaptee instance and assigning the default adapting strategy
aTargetInterface
- Target interface typeanAdaptee
- Adaptee instance
IllegalArgumentException
- 'aTargetInterface' must not be null
IllegalArgumentException
- 'anAdaptee' must not be nullMethod Detail |
---|
public A getAdaptee()
Adaptee
instance
getAdaptee
in interface IAdapter<T,A>
Adaptee
instancepublic T getTarget()
Target
instance
getTarget
in interface IAdapter<T,A>
Target
instancepublic final void setAdaptingStrategy(IAdaptingStrategy anAdaptingStrategy) throws IllegalArgumentException
setAdaptingStrategy
in interface IAdapter<T,A>
anAdaptingStrategy
- IAdaptingStrategy
instance to assign
IllegalArgumentException
- 'anAdaptingStrategy' must not be nullprotected Object invokeUnderlying(Method aMethod, Object[] anArguments) throws Throwable
invokeUnderlying
in class AbstractSurrogate<T,A>
aMethod
- Method to invokeanArguments
- Array of input arguments for the Method to invoke
Throwable
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |