Package net.bytebuddy.utility.dispatcher
Class JavaDispatcher.DirectInvoker
- java.lang.Object
-
- net.bytebuddy.utility.dispatcher.JavaDispatcher.DirectInvoker
-
- All Implemented Interfaces:
Invoker
- Enclosing class:
- JavaDispatcher<T>
@Enhance private static class JavaDispatcher.DirectInvoker extends java.lang.Object implements Invoker
AnInvokerthat 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 privateDirectInvoker()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.Objectinvoke(java.lang.reflect.Method method, java.lang.Object instance, java.lang.Object[] argument)Invokes a method viaMethod.invoke(Object, Object...).java.lang.ObjectnewInstance(java.lang.reflect.Constructor<?> constructor, java.lang.Object[] argument)Creates a new instance viaConstructor.newInstance(Object...).
-
-
-
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.InvocationTargetExceptionCreates a new instance viaConstructor.newInstance(Object...).- Specified by:
newInstancein interfaceInvoker- 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.InvocationTargetExceptionInvokes a method viaMethod.invoke(Object, Object...).- Specified by:
invokein interfaceInvoker- Parameters:
method- The method to invoke.instance- The instance upon which to invoke the method ornullif the method is static.argument- The method arguments.- Returns:
- The return value of the method or
nullif the method isvoid. - Throws:
java.lang.IllegalAccessException- If the method is accessed illegally.java.lang.reflect.InvocationTargetException- If the invocation causes an error.
-
-