Class MethodHandleWrapper
- java.lang.Object
-
- software.amazon.disco.agent.reflect.MethodHandleWrapper
-
@Deprecated public class MethodHandleWrapper extends java.lang.ObjectDeprecated.deprecated in favour ofsoftware.amazon.disco.agent.interception.templates.DataAccessorwhich should be used wherever possible instead.Simple utility to produce MethodHandles for commonly accessed methods Generally we need to access methods reflectively, to account for times when the Agent is built such that it is loaded into the Bootstrap classloader, which will not have direct access to classes loaded by the System classloader such as Apache classes, Servlet classes, ...
-
-
Constructor Summary
Constructors Constructor Description MethodHandleWrapper(java.lang.String className, java.lang.ClassLoader classLoader, java.lang.String methodName, java.lang.Class rtype)Deprecated.Create a new MethodHandleWrapperMethodHandleWrapper(java.lang.String className, java.lang.ClassLoader classLoader, java.lang.String methodName, java.lang.Class rtype, java.lang.Class... ptypes)Deprecated.Create a new MethodHandleWrapperMethodHandleWrapper(java.lang.String className, java.lang.ClassLoader classLoader, java.lang.String methodName, java.lang.Class rtype, java.lang.String... ptypes)Deprecated.Create a new MethodHandleWrapperMethodHandleWrapper(java.lang.String className, java.lang.ClassLoader classLoader, java.lang.String methodName, java.lang.String rtype, java.lang.String... ptypes)Deprecated.Create a new MethodHandleWrapper
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description java.lang.ClassgetRtype()Deprecated.Get the return type of the method referred to by this MethodHandleWrapperjava.lang.Objectinvoke(java.lang.Object receiver, java.lang.Object... args)Deprecated.Invoke the method referred to by this MethodHandleWrapperbooleanisHandleLoaded()Deprecated.Method to provide information whether MethodHandle is loaded or not eg: returns false if any exceptions are thrown while building MethodHandle
-
-
-
Constructor Detail
-
MethodHandleWrapper
public MethodHandleWrapper(java.lang.String className, java.lang.ClassLoader classLoader, java.lang.String methodName, java.lang.Class rtype, java.lang.Class... ptypes)Deprecated.Create a new MethodHandleWrapper- Parameters:
className- the fully qualified name of the owning classclassLoader- the ClassLoader to be used for finding className, should probably by ClassLoader.getSystemClassLoader()methodName- the name of the method being looked uprtype- the return type of the methodptypes- the types of the parameters to the method
-
MethodHandleWrapper
public MethodHandleWrapper(java.lang.String className, java.lang.ClassLoader classLoader, java.lang.String methodName, java.lang.Class rtype)Deprecated.Create a new MethodHandleWrapper- Parameters:
className- the fully qualified name of the owning classclassLoader- the ClassLoader to be used for finding className, should probably by ClassLoader.getSystemClassLoader()methodName- the name of the method being looked uprtype- the return type of the method
-
MethodHandleWrapper
public MethodHandleWrapper(java.lang.String className, java.lang.ClassLoader classLoader, java.lang.String methodName, java.lang.Class rtype, java.lang.String... ptypes)Deprecated.Create a new MethodHandleWrapper- Parameters:
className- the fully qualified name of the owning classclassLoader- the ClassLoader to be used for finding className, should probably by ClassLoader.getSystemClassLoader()methodName- the name of the method being looked uprtype- the return type of the methodptypes- the names of the types of the parameters to the method
-
MethodHandleWrapper
public MethodHandleWrapper(java.lang.String className, java.lang.ClassLoader classLoader, java.lang.String methodName, java.lang.String rtype, java.lang.String... ptypes) throws java.lang.ExceptionDeprecated.Create a new MethodHandleWrapper- Parameters:
className- the fully qualified name of the owning classclassLoader- the ClassLoader to be used for finding className, should probably by ClassLoader.getSystemClassLoader()methodName- the name of the method being looked uprtype- the name of the return type of the methodptypes- the names of the types of the parameters to the method- Throws:
java.lang.Exception- - ClassNotFoundException could be thrown if classpath for rtype is not found.
-
-
Method Detail
-
invoke
public java.lang.Object invoke(java.lang.Object receiver, java.lang.Object... args)Deprecated.Invoke the method referred to by this MethodHandleWrapper- Parameters:
receiver- the object upon which this method is being invoked, the 'this' of the method callargs- the arguments being passed to the method, which should match the types given during construction as 'ptypes'- Returns:
- the return value of the invoked method
-
getRtype
public java.lang.Class getRtype()
Deprecated.Get the return type of the method referred to by this MethodHandleWrapper- Returns:
- the class of the method's return type
-
isHandleLoaded
public boolean isHandleLoaded()
Deprecated.Method to provide information whether MethodHandle is loaded or not eg: returns false if any exceptions are thrown while building MethodHandle- Returns:
- the
Boolean
-
-