|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.perfectjpattern.core.extras.delegate.AbstractDelegator<I>
I
- Interface type built by this Delegator
instance.public abstract class AbstractDelegator<I>
Abstract base implementation of IDelegator
interface.
Notes: Base source code implemented by Steve Lewis and Wilhelm
Fitzpatrick and adapted to fit PerfectJPattern componentization
criteria and code conventions.
IDelegator
Nested Class Summary | |
---|---|
protected class |
AbstractDelegator.DelegateProxy
|
Constructor Summary | |
---|---|
protected |
AbstractDelegator(Class<I> anInterface)
Constructs Delegator instance using an interface type
that implements exactly one method. |
protected |
AbstractDelegator(Class aReturnClass,
Class... aParameters)
Constructs Delegator instance using a method
signature. |
Method Summary | |
---|---|
protected static Method |
findMethod(Class anInterface)
Returns suitable Method found for the given interface type. |
protected Method |
findMethod(Class aTargetClass,
String aMethodName,
AbstractDelegator aDelegator)
Returns suitable Method within class type that matches the given Delegator signature. |
protected static Method[] |
findMethod(Class aTargetClass,
String aMethodName,
int aNumberOfArguments)
Returns all candidate methods within a class that match the given signature. |
protected Class[] |
getArguments()
Returns the Arguments class types. |
protected Class |
getReturn()
Returns the Return class type. |
protected boolean |
isSuitableMethod(Method aTestMethod,
Class aReturnClass,
Class... anArguments)
Returns true if the Method matches the given signature specified by Arguments and Return, false otherwise. |
protected boolean |
isValidReturn(Method aTestMethod,
Class aReturnClass)
Returns true if return type matches the expected type, false otherwise. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface org.perfectjpattern.core.api.extras.delegate.IDelegator |
---|
build, build |
Constructor Detail |
---|
protected AbstractDelegator(Class aReturnClass, Class... aParameters)
Delegator
instance using a method
signature.
aReturnClass
- Return class type.aParameters
- Parameter class types.protected AbstractDelegator(Class<I> anInterface)
Delegator
instance using an interface type
that implements exactly one method.
anInterface
- Interface with EXACTLY one method.
IllegalArgumentException
- DelegateTemplate must be constructed
with an interface implementing exactly one method!Method Detail |
---|
protected boolean isSuitableMethod(Method aTestMethod, Class aReturnClass, Class... anArguments)
aTestMethod
- anArguments
- aReturnClass
-
protected boolean isValidReturn(Method aTestMethod, Class aReturnClass)
aTestMethod
- aReturnClass
-
protected static Method[] findMethod(Class aTargetClass, String aMethodName, int aNumberOfArguments)
aTargetClass
- aMethodName
- aNumberOfArguments
-
protected Method findMethod(Class aTargetClass, String aMethodName, AbstractDelegator aDelegator) throws IllegalArgumentException, UnsupportedOperationException
aTargetClass
- Class type to search for matching method.aMethodName
- Method name to search for.aDelegator
- Delegate specification.
IllegalArgumentException
- Requested method returns wrong type.
IllegalArgumentException
- Requested method is not public.
UnsupportedOperationException
- No suitable method found.protected static Method findMethod(Class anInterface)
Method
found for the given interface type.
anInterface
-
Method
IllegalArgumentException
- 'anInterface' must not be null.
IllegalArgumentException
- DelegateTemplate must be constructed
with an interface implementing exactly one method!protected Class getReturn()
protected Class[] getArguments()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |