public class Delegator extends Object
Modifier and Type | Class and Description |
---|---|
static class |
Delegator.DelegateInvokeException
All problems become this type of exception
As a runtime we do not impose burdens on the calling code
|
protected class |
Delegator.DelegateProxy |
Modifier and Type | Field and Description |
---|---|
static Delegator[] |
EMPTY_ARRAY |
static Method[] |
EMPTY_METHOD_ARRAY |
static Object[] |
EMPTY_OBJECT_ARRAY |
static Delegator |
RUNNABLE_DELEGATE |
Constructor and Description |
---|
Delegator(Class TheInterface) |
Delegator(Class[] params,
Class retClass) |
Modifier and Type | Method and Description |
---|---|
IDelegate |
build(Class target,
String MethodName) |
IDelegate |
build(Object target,
String MethodName) |
static Runnable |
buildRunnable(Class item,
String methodName)
Convenience method to make a runnable delegate
|
static Runnable |
buildRunnable(Object item,
String methodName)
Convenience method to make a runnable delegate
|
protected static Method |
findMethod(Class TheInterface)
utility code to find the one suitable method in the passed in interface.
|
protected static Method |
findSuitableMethod(Class targetClass,
String MethodName,
Delegator templ)
Utility method to locate a proper Method object
|
Class[] |
getArguments()
accessor for argument classes
|
protected static Method[] |
getCandidateMethods(Class targetClass,
String MethodName,
int nargs)
utility method to get candidate methods to search
|
Class |
getInterface() |
Class |
getReturn()
accessor for return class
|
protected static boolean |
isSuitableMethod(Method testMethod,
Class[] args,
Class retClass)
utility method to test suitability
|
protected static boolean |
isValidReturn(Method test,
Class retClass)
utility method to test return
|
public static final Method[] EMPTY_METHOD_ARRAY
public static final Object[] EMPTY_OBJECT_ARRAY
public static final Delegator[] EMPTY_ARRAY
public static final Delegator RUNNABLE_DELEGATE
public Delegator(Class[] params, Class retClass)
params
- non-null array of argumentsretClass
- possibly null return class null says do not carepublic Delegator(Class TheInterface)
TheInterface
- an non-null interface with EXACTLY one methodpublic static Runnable buildRunnable(Object item, String methodName)
item
- non-null target objectmethodName
- non-null name of a method of type void ()public static Runnable buildRunnable(Class item, String methodName)
item
- non-null target classmethodName
- non-null name of a method of type void ()public Class getReturn()
public Class[] getArguments()
public Class getInterface()
public IDelegate build(Class target, String MethodName)
target
- non-null class with a bindable static methodMethodName
- name of the static methodpublic IDelegate build(Object target, String MethodName)
target
- non-null target with a bindable methodMethodName
- name of the methodprotected static boolean isSuitableMethod(Method testMethod, Class[] args, Class retClass)
args
- - Class[]retClass
- - ClasstestMethod
- - Methodprotected static Method[] getCandidateMethods(Class targetClass, String MethodName, int nargs)
MethodName
- - Stringnargs
- - inttargetClass
- - Classprotected static boolean isValidReturn(Method test, Class retClass)
retClass
- - Classtest
- - Methodprotected static Method findSuitableMethod(Class targetClass, String MethodName, Delegator templ)
targetClass
- - ClassMethodName
- - Stringtempl
- - DelegatorCopyright © 2015 VersionOne, Inc.. All rights reserved.