Class JavaDispatcher.DirectInvoker

  • All Implemented Interfaces:
    Invoker
    Enclosing class:
    JavaDispatcher<T>

    @Enhance
    private static class JavaDispatcher.DirectInvoker
    extends java.lang.Object
    implements Invoker
    An Invoker that uses Byte Buddy's invocation context to use if dynamic class loading is not supported, for example on Android, and that do not use secured contexts, where this security measure is obsolete to begin with.
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      private DirectInvoker()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.Object invoke​(java.lang.reflect.Method method, java.lang.Object instance, java.lang.Object[] argument)
      Invokes a method via Method.invoke(Object, Object...).
      java.lang.Object newInstance​(java.lang.reflect.Constructor<?> constructor, java.lang.Object[] argument)
      Creates a new instance via Constructor.newInstance(Object...).
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • DirectInvoker

        private DirectInvoker()
    • Method Detail

      • newInstance

        public java.lang.Object newInstance​(java.lang.reflect.Constructor<?> constructor,
                                            java.lang.Object[] argument)
                                     throws java.lang.InstantiationException,
                                            java.lang.IllegalAccessException,
                                            java.lang.reflect.InvocationTargetException
        Creates a new instance via Constructor.newInstance(Object...).
        Specified by:
        newInstance in interface Invoker
        Parameters:
        constructor - The constructor to invoke.
        argument - The constructor arguments.
        Returns:
        The constructed instance.
        Throws:
        java.lang.InstantiationException - If the instance cannot be constructed.
        java.lang.IllegalAccessException - If the constructor is accessed illegally.
        java.lang.reflect.InvocationTargetException - If the invocation causes an error.
      • invoke

        public java.lang.Object invoke​(java.lang.reflect.Method method,
                                       @MaybeNull
                                       java.lang.Object instance,
                                       @MaybeNull
                                       java.lang.Object[] argument)
                                throws java.lang.IllegalAccessException,
                                       java.lang.reflect.InvocationTargetException
        Invokes a method via Method.invoke(Object, Object...).
        Specified by:
        invoke in interface Invoker
        Parameters:
        method - The method to invoke.
        instance - The instance upon which to invoke the method or null if the method is static.
        argument - The method arguments.
        Returns:
        The return value of the method or null if the method is void.
        Throws:
        java.lang.IllegalAccessException - If the method is accessed illegally.
        java.lang.reflect.InvocationTargetException - If the invocation causes an error.