T - - the return type of the method being calledpublic class ReflectiveCall<T>
extends java.lang.Object
| Modifier and Type | Method and Description |
|---|---|
T |
call(java.lang.Object... args)
Invoke the given method with the given args.
|
void |
dispatchException(java.lang.Throwable t,
java.lang.Object... args)
Tries to dispatch an exception to the installed UncaughtExceptionHandler.
|
java.lang.Class[] |
getArgTypes()
Get the array of argument types specified in this ReflectiveCall
|
java.lang.String |
getClassName()
Get the class name specified in this ReflectiveCall
|
java.lang.String |
getMethodName()
Get the name of the method specified in this ReflectiveCall
|
java.lang.Class |
getReturnType()
Get the class return type of the method specified in this ReflectiveCall
|
static void |
installUncaughtExceptionHandler(UncaughtExceptionHandler handler)
Install an UncaughtExceptionHandler, to receive a notification whe any exception is thrown by any method in the
DiSCo reflect APIs.
|
static boolean |
isAgentPresent()
Test if a DiSCo agent is present
|
boolean |
methodFound()
Test if the method about to be called exists or not
|
ReflectiveCall<T> |
ofClass(java.lang.String className)
Set the partial class name which declares the method to be called as it appears after software.amazon.disco.agent
e.g.
|
ReflectiveCall<T> |
ofMethod(java.lang.String methodName)
Set the name of the method to be called
|
ReflectiveCall<T> |
onInstance(java.lang.Object thiz)
For non-static methods, set the instance object on which to invoke the method
|
static <T> ReflectiveCall<T> |
returning(java.lang.Class<T> clazz)
Factory method to create a new ReflectiveCall which is on a method returning the given type
|
static ReflectiveCall |
returningVoid()
Factory method to create a new ReflectiveCall which is on a void method
|
java.lang.String |
toString() |
ReflectiveCall<T> |
withArgTypes(java.lang.Class... argTypes)
Declare the expected method signature by its arguments
|
ReflectiveCall<T> |
withDefaultValue(T defaultValue)
Set the default value to return in case no DiSCo agent is present.
|
public static ReflectiveCall returningVoid()
public static <T> ReflectiveCall<T> returning(java.lang.Class<T> clazz)
T - the class of the method's return typeclazz - the class of the method's return typepublic ReflectiveCall<T> withDefaultValue(T defaultValue)
defaultValue - The default valuepublic ReflectiveCall<T> ofClass(java.lang.String className)
className - the class name which declares the methodpublic ReflectiveCall<T> ofMethod(java.lang.String methodName)
methodName - the name of the method to be calledpublic ReflectiveCall<T> onInstance(java.lang.Object thiz)
thiz - the instance object on which to invoke the methodpublic ReflectiveCall<T> withArgTypes(java.lang.Class... argTypes)
argTypes - array of types for method lookuppublic boolean methodFound()
public T call(java.lang.Object... args)
args - any arguments to pass to the method invocation.public static boolean isAgentPresent()
public static void installUncaughtExceptionHandler(UncaughtExceptionHandler handler)
handler - a callback to receive any unhandled exceptions in client codepublic void dispatchException(java.lang.Throwable t,
java.lang.Object... args)
t - the throwable to notify the calling code, via any installed UncaughtExceptionHandlerargs - any arguments to notify the UncaughtExceptionHandler ofpublic java.lang.String toString()
toString in class java.lang.Objectpublic java.lang.String getClassName()
public java.lang.Class getReturnType()
public java.lang.String getMethodName()
public java.lang.Class[] getArgTypes()