Top Description Methods
org.easymock.bytebuddy.utility

public Interface Invoker

Known Direct Implementers
org.easymock.bytebuddy.utility.dispatcher.JavaDispatcher.DirectInvoker
Imports
org.easymock.bytebuddy.utility.nullability.MaybeNull, java.lang.reflect.Constructor, .InvocationTargetException, .Method

An invoker is a deliberate indirection to wrap indirect calls. This way, reflective call are never dispatched from Byte Buddy's context but always from a synthetic layer that does not own any privileges. This might not be the case if such security measures are not supported on the current platform, for example on Android. To support the Java module system and other class loader with explicit exports such as OSGi, this interface is placed in an exported package while intended for use with org.easymock.bytebuddy.utility.dispatcher.JavaDispatcher.

Method Summary

Modifier and TypeMethod and Description
public Object

Returns:

The return value of the method or null if the method is void.
invoke
(Method
The method to invoke.
method
,
Object
The instance upon which to invoke the method or null if the method is static.
instance
,
Object[]
The method arguments.
argument
)

Invokes a method via Method#invoke(Object, Object...).

public Object

Returns:

The constructed instance.
newInstance
(Constructor<?>
The constructor to invoke.
constructor
,
Object[]
The constructor arguments.
argument
)

Creates a new instance via Constructor#newInstance(Object...).

Method Detail

invokeback to summary
public Object invoke(Method method, Object instance, Object[] argument) throws IllegalAccessException, InvocationTargetException

Invokes a method via Method#invoke(Object, Object...).

Parameters
method:Method

The method to invoke.

instance:Object

The instance upon which to invoke the method or null if the method is static.

argument:Object[]

The method arguments.

Returns:Object

The return value of the method or null if the method is void.

Annotations
@MaybeNull
Exceptions
IllegalAccessException:
If the method is accessed illegally.
InvocationTargetException:
If the invocation causes an error.
newInstanceback to summary
public Object newInstance(Constructor<?> constructor, Object[] argument) throws InstantiationException, IllegalAccessException, InvocationTargetException

Creates a new instance via Constructor#newInstance(Object...).

Parameters
constructor:Constructor<?>

The constructor to invoke.

argument:Object[]

The constructor arguments.

Returns:Object

The constructed instance.

Exceptions
InstantiationException:
If the instance cannot be constructed.
IllegalAccessException:
If the constructor is accessed illegally.
InvocationTargetException:
If the invocation causes an error.