Class MethodHandleWrapper


  • @Deprecated
    public class MethodHandleWrapper
    extends java.lang.Object
    Deprecated.
    deprecated in favour of software.amazon.disco.agent.interception.templates.DataAccessor which 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 MethodHandleWrapper
      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
      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
      MethodHandleWrapper​(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.Class getRtype()
      Deprecated.
      Get the return type of the method referred to by this MethodHandleWrapper
      java.lang.Object invoke​(java.lang.Object receiver, java.lang.Object... args)
      Deprecated.
      Invoke the method referred to by this MethodHandleWrapper
      boolean isHandleLoaded()
      Deprecated.
      Method to provide information whether MethodHandle is loaded or not eg: returns false if any exceptions are thrown while building MethodHandle
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • 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 class
        classLoader - the ClassLoader to be used for finding className, should probably by ClassLoader.getSystemClassLoader()
        methodName - the name of the method being looked up
        rtype - the return type of the method
        ptypes - 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 class
        classLoader - the ClassLoader to be used for finding className, should probably by ClassLoader.getSystemClassLoader()
        methodName - the name of the method being looked up
        rtype - 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 class
        classLoader - the ClassLoader to be used for finding className, should probably by ClassLoader.getSystemClassLoader()
        methodName - the name of the method being looked up
        rtype - the return type of the method
        ptypes - 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.Exception
        Deprecated.
        Create a new MethodHandleWrapper
        Parameters:
        className - the fully qualified name of the owning class
        classLoader - the ClassLoader to be used for finding className, should probably by ClassLoader.getSystemClassLoader()
        methodName - the name of the method being looked up
        rtype - the name of the return type of the method
        ptypes - 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 call
        args - 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