|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.versionone.util.Delegator
public class Delegator
Delegator class from the article http://www.onjava.com/pub/a/onjava/2003/05/21/delegates.html?page=1 Class representing a delegate template - also a factory returning the real delegate object
| Nested Class Summary | |
|---|---|
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
|
| Field Summary | |
|---|---|
static Delegator[] |
EMPTY_ARRAY
|
static java.lang.reflect.Method[] |
EMPTY_METHOD_ARRAY
|
static java.lang.Object[] |
EMPTY_OBJECT_ARRAY
|
static Delegator |
RUNNABLE_DELEGATE
|
| Constructor Summary | |
|---|---|
Delegator(java.lang.Class TheInterface)
|
|
Delegator(java.lang.Class[] params,
java.lang.Class retClass)
|
|
| Method Summary | |
|---|---|
IDelegate |
build(java.lang.Class target,
java.lang.String MethodName)
|
IDelegate |
build(java.lang.Object target,
java.lang.String MethodName)
|
static java.lang.Runnable |
buildRunnable(java.lang.Class item,
java.lang.String methodName)
Convenience method to make a runnable delegate |
static java.lang.Runnable |
buildRunnable(java.lang.Object item,
java.lang.String methodName)
Convenience method to make a runnable delegate |
protected static java.lang.reflect.Method |
findMethod(java.lang.Class TheInterface)
utility code to find the one suitable method in the passed in interface. |
protected static java.lang.reflect.Method |
findSuitableMethod(java.lang.Class targetClass,
java.lang.String MethodName,
Delegator templ)
Utility method to locate a proper Method object |
java.lang.Class[] |
getArguments()
accessor for argument classes |
protected static java.lang.reflect.Method[] |
getCandidateMethods(java.lang.Class targetClass,
java.lang.String MethodName,
int nargs)
utility method to get candidate methods to search |
java.lang.Class |
getInterface()
|
java.lang.Class |
getReturn()
accessor for return class |
protected static boolean |
isSuitableMethod(java.lang.reflect.Method testMethod,
java.lang.Class[] args,
java.lang.Class retClass)
utility method to test suitability |
protected static boolean |
isValidReturn(java.lang.reflect.Method test,
java.lang.Class retClass)
utility method to test return |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final java.lang.reflect.Method[] EMPTY_METHOD_ARRAY
public static final java.lang.Object[] EMPTY_OBJECT_ARRAY
public static final Delegator[] EMPTY_ARRAY
public static final Delegator RUNNABLE_DELEGATE
| Constructor Detail |
|---|
public Delegator(java.lang.Class[] params,
java.lang.Class retClass)
params - non-null array of argumentsretClass - possibly null return class null says do not carepublic Delegator(java.lang.Class TheInterface)
TheInterface - an non-null interface with EXACTLY one method| Method Detail |
|---|
public static java.lang.Runnable buildRunnable(java.lang.Object item,
java.lang.String methodName)
item - non-null target objectmethodName - non-null name of a method of type void ()
public static java.lang.Runnable buildRunnable(java.lang.Class item,
java.lang.String methodName)
item - non-null target classmethodName - non-null name of a method of type void ()
public java.lang.Class getReturn()
public java.lang.Class[] getArguments()
public java.lang.Class getInterface()
public IDelegate build(java.lang.Class target,
java.lang.String MethodName)
target - non-null class with a bindable static methodMethodName - name of the static method
public IDelegate build(java.lang.Object target,
java.lang.String MethodName)
target - non-null target with a bindable methodMethodName - name of the method
protected static boolean isSuitableMethod(java.lang.reflect.Method testMethod,
java.lang.Class[] args,
java.lang.Class retClass)
protected static java.lang.reflect.Method[] getCandidateMethods(java.lang.Class targetClass,
java.lang.String MethodName,
int nargs)
protected static boolean isValidReturn(java.lang.reflect.Method test,
java.lang.Class retClass)
protected static java.lang.reflect.Method findSuitableMethod(java.lang.Class targetClass,
java.lang.String MethodName,
Delegator templ)
protected static java.lang.reflect.Method findMethod(java.lang.Class TheInterface)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||