org.perfectjpattern.core.extras.delegate
Class DynamicDelegator
java.lang.Object
org.perfectjpattern.core.extras.delegate.AbstractDelegator<IDelegate>
org.perfectjpattern.core.extras.delegate.DynamicDelegator
- All Implemented Interfaces:
- IDelegator<IDelegate>
public final class DynamicDelegator
- extends AbstractDelegator<IDelegate>
Implementation of IDelegator
interface for creating
Delegate instances based on the dynamic IDelegate
type. DynamicDelegator
should be used in cases where
there is no known interface definition for the targeted method.
Notes: Base source code implemented by Steve Lewis and Wilhelm
Fitzpatrick and adapted to fit PerfectJPattern componentization
criteria and code conventions.
- Version:
- $Revision: 1.0 $ $Date: Jun 25, 2007 7:07:18 AM $
- Author:
- Steve Lewis, Wilhelm
Fitzpatrick, Giovanni Azua
- See Also:
IDelegate
-
-
Constructor Summary |
DynamicDelegator(Class aReturnClass,
Class... aParameters)
Construct a DynamicDelegator by specifying the target
method signature. |
Method Summary |
IDelegate |
build(Class aTarget,
String aMethodName)
Returns Dynamic Proxy that implements the target generic parameter
interface. |
IDelegate |
build(Object aTarget,
String aMethodName)
Returns Dynamic Proxy that implements the target generic parameter
interface. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
DynamicDelegator
public DynamicDelegator(Class aReturnClass,
Class... aParameters)
- Construct a
DynamicDelegator
by specifying the target
method signature. The method signature is defined by the types of the
parameters and return.
- Parameters:
aReturnClass
- Return type for the targeted method.aParameters
- Array of method parameter types.
build
public IDelegate build(Class aTarget,
String aMethodName)
throws IllegalArgumentException,
UnsupportedOperationException
- Returns Dynamic Proxy that implements the target generic parameter
interface. The implementing Dynamic Proxy executes the underlying
method identified by Class type and Method name.
- Parameters:
aTarget
- non-null class with a bindable static method.aMethodName
- name of the static method.
- Returns:
- Dynamic proxy implementing the target generic interface.
- Throws:
IllegalArgumentException
- 'aTarget' must not be null.
UnsupportedOperationException
- No suitable method found.
build
public IDelegate build(Object aTarget,
String aMethodName)
throws IllegalArgumentException,
UnsupportedOperationException
- Returns Dynamic Proxy that implements the target generic parameter
interface. The implementing Dynamic Proxy executes the underlying
method identified by Object instance and Method name.
- Parameters:
aTarget
- non-null target with a bindable method.aMethodName
- name of the method.
- Returns:
- Dynamic proxy implementing the target generic interface.
- Throws:
IllegalArgumentException
- 'aTarget' must not be null.
UnsupportedOperationException
- No suitable method found.
Copyright © 2007-2009. All Rights Reserved.