protected class Delegator.DelegateProxy extends Object implements IDelegate, InvocationHandler
Modifier | Constructor and Description |
---|---|
protected |
DelegateProxy(Object target,
Class targetClass,
String methodName,
Delegator template)
constructor supplying a Class passing in types not template
|
Modifier and Type | Method and Description |
---|---|
Method |
getMethod()
accessor for the method
|
Object |
getTarget()
accessor for the target
|
Object |
invoke()
convenience call to handle case of no arguments
|
Object |
invoke(Object arg)
convenience call to handle case of one argument
|
Object |
invoke(Object[] args)
basic call to method
|
Object |
invoke(Object proxy,
Method method,
Object[] args)
method required by InvocationHandler so we can build dynamic Proxys
|
Object |
invoke(Object arg1,
Object arg2)
convenience call to handle case of two argument
|
protected void |
validateArgs(Object[] args)
if uncommented in invoke this code will throw an IllegalArgument call
if arguments are of the wrong type
|
protected DelegateProxy(Object target, Class targetClass, String methodName, Delegator template)
target
- possibly null target if null the method must be statictargetClass
- non-null class implementing a suitable methodmethodName
- nun-null name of a public static method in targettemplate
- non-null template with the required arguemts and returnpublic Object invoke() throws IllegalArgumentException, Delegator.DelegateInvokeException
invoke
in interface IDelegate
IllegalArgumentException
Delegator.DelegateInvokeException
public Object invoke(Object arg) throws IllegalArgumentException, Delegator.DelegateInvokeException
invoke
in interface IDelegate
arg
- some argumentIllegalArgumentException
Delegator.DelegateInvokeException
public Object invoke(Object arg1, Object arg2) throws IllegalArgumentException, Delegator.DelegateInvokeException
invoke
in interface IDelegate
arg1
- some argumentarg2
- some argumentIllegalArgumentException
Delegator.DelegateInvokeException
public Object invoke(Object proxy, Method method, Object[] args)
invoke
in interface InvocationHandler
proxy
- object for which we are a proxy (ignored)method
- method to call (ignored)args
- arguments to passpublic Object invoke(Object[] args) throws IllegalArgumentException, Delegator.DelegateInvokeException
invoke
in interface IDelegate
args
- method argumentsIllegalArgumentException
Delegator.DelegateInvokeException
protected void validateArgs(Object[] args) throws IllegalArgumentException
args
- - ObjectIllegalArgumentException
- - IllegalArgumentExceptionpublic Method getMethod()
public Object getTarget()
Copyright © 2015 VersionOne, Inc.. All rights reserved.