|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.perfectjpattern.core.structural.adapter.ExactMatchAdaptingStrategy
public class ExactMatchAdaptingStrategy
Concrete implementation of IAdaptingStrategy
. Implements the exact
matching strategy. The Adaptee and Target methods (name and parameters) must
match or at least the Adaptee methods must be a subset of Target methods.
Constructor Summary | |
---|---|
ExactMatchAdaptingStrategy()
|
Method Summary | |
---|---|
Method |
resolve(Class<?> aTargetClass,
Object anAdaptee,
Object anAdapter,
Method aTargetMethod)
Returns the Adaptee or otherwise Adapter method
that corresponds to the given Target class type. |
protected Method |
resolve(Object anObject,
Method aMethodPrototype)
Returns the found matching Method if exists, null or
NoSuchMethodError otherwise |
protected Method |
resolve(Object anObject,
Method aMethodPrototype,
String aMethodName)
Returns the found matching Method if exists, null or
NoSuchMethodError otherwise |
void |
validate(Class<?> aTargetClass,
Object anAdaptee,
Object anAdapter)
According to the definition of this strategy validates the tuple
Target /Adaptee . |
protected void |
validate(Class<?> anInterface,
Object anImplementor,
Set<String> aTargetMethods)
Removes from aTargetMethods all methods found in anInterface that are actually implemented by anImplementor |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ExactMatchAdaptingStrategy()
Method Detail |
---|
public void validate(Class<?> aTargetClass, Object anAdaptee, Object anAdapter) throws NoSuchMethodError
Target
/Adaptee
. Should the two not match an
NoSuchMethodError
will be thrown.
validate
in interface IAdaptingStrategy
aTargetClass
- Target class typeanAdaptee
- Adaptee instanceanAdapter
- Adapter instance
NoSuchMethodError
public Method resolve(Class<?> aTargetClass, Object anAdaptee, Object anAdapter, Method aTargetMethod) throws IllegalArgumentException, NoSuchMethodError
Adaptee
or otherwise Adapter
method
that corresponds to the given Target
class type. If the
corresponding method is not found an NoSuchMethodError
will
be thrown.
resolve
in interface IAdaptingStrategy
aTargetClass
- Target class typeanAdaptee
- Adaptee instanceanAdapter
- Adapter instanceaTargetMethod
- Target method to search for in the Adaptee
Adaptee
method that corresponds to the given
Target
class type
NoSuchMethodError
IllegalArgumentException
IAdaptingStrategy.validate(Class, Object, Object)
protected void validate(Class<?> anInterface, Object anImplementor, Set<String> aTargetMethods)
anInterface
- The target interfaceanImplementor
- The underlying implementoraTargetMethods
- The methods to search forprotected Method resolve(Object anObject, Method aMethodPrototype, String aMethodName) throws NoSuchMethodError
Method
if exists, null or
NoSuchMethodError
otherwise
anObject
- aMethodPrototype
- aMethodName
-
Method
if exists, null or
NoSuchMethodError
otherwise
NoSuchMethodError
protected Method resolve(Object anObject, Method aMethodPrototype) throws NoSuchMethodError
Method
if exists, null or
NoSuchMethodError
otherwise
anObject
- aMethodPrototype
-
Method
if exists, null or
NoSuchMethodError
otherwise
NoSuchMethodError
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |