Top Description Inners Fields Constructors Methods
org.easymock.bytebuddy.implementation

public Class MethodCall

extends Object
implements Composable
Class Inheritance
All Implemented Interfaces
org.easymock.bytebuddy.implementation.Implementation.Composable, org.easymock.bytebuddy.implementation.Implementation, org.easymock.bytebuddy.dynamic.scaffold.InstrumentedType.Prepareable
Known Direct Subclasses
org.easymock.bytebuddy.implementation.MethodCall.WithoutSpecifiedTarget
Annotations
@Enhance
Imports
edu.umd.cs.findbugs.annotations.SuppressFBWarnings, org.easymock.bytebuddy.build.HashCodeAndEqualsPlugin, org.easymock.bytebuddy.description.enumeration.EnumerationDescription, org.easymock.bytebuddy.description.field.FieldDescription, .FieldList, org.easymock.bytebuddy.description.method.MethodDescription, .ParameterDescription, .ParameterList, org.easymock.bytebuddy.description.type.TypeDefinition, .TypeDescription, org.easymock.bytebuddy.dynamic.scaffold.FieldLocator, .InstrumentedType, .MethodGraph, org.easymock.bytebuddy.implementation.bytecode.*, org.easymock.bytebuddy.implementation.bytecode.assign.Assigner, org.easymock.bytebuddy.implementation.bytecode.collection.ArrayAccess, .ArrayFactory, org.easymock.bytebuddy.implementation.bytecode.constant.*, org.easymock.bytebuddy.implementation.bytecode.member.FieldAccess, .MethodInvocation, .MethodReturn, .MethodVariableAccess, org.easymock.bytebuddy.matcher.ElementMatcher, .ElementMatchers, org.easymock.bytebuddy.utility.*, org.easymock.bytebuddy.utility.nullability.MaybeNull, org.easymock.bytebuddy.jar.asm.MethodVisitor, .Opcodes, java.lang.reflect.Constructor, .Field, .Method, .Type, java.util.*, java.util.concurrent.Callable

This Implementation allows the invocation of a specified method while providing explicit arguments to this method.

Nested and Inner Type Summary

Modifier and TypeClass and Description
protected class
public static interface
MethodCall.ArgumentLoader

An argument loader is responsible for loading an argument for an invoked method onto the operand stack.

public static class
MethodCall.FieldSetting

A MethodCall that sets the call's result as the value of a field.

protected static interface
MethodCall.MethodInvoker

A method invoker is responsible for creating a method invocation that is to be applied by a org.easymock.bytebuddy.implementation.MethodCall.

public static interface
MethodCall.MethodLocator

A method locator is responsible for identifying the method that is to be invoked by a org.easymock.bytebuddy.implementation.MethodCall.

protected static interface
MethodCall.TargetHandler

A target handler is responsible for invoking a method for a org.easymock.bytebuddy.implementation.MethodCall.

protected static interface
MethodCall.TerminationHandler

A termination handler is responsible to handle the return value of a method that is invoked via a org.easymock.bytebuddy.implementation.MethodCall.

public static class
MethodCall.WithoutSpecifiedTarget

Represents a org.easymock.bytebuddy.implementation.MethodCall that invokes a method without specifying an invocation method.

Field Summary

Modifier and TypeField and Description
protected final List<MethodCall.ArgumentLoader.Factory>
argumentLoaders

The argument loader to load arguments onto the operand stack in their application order.

protected final Assigner
assigner

The assigner to use.

protected final MethodCall.MethodInvoker.Factory
methodInvoker

The method invoker to use.

protected final MethodCall.MethodLocator.Factory
methodLocator

The method locator to use.

protected final MethodCall.TargetHandler.Factory
targetHandler

The target handler to use.

protected final MethodCall.TerminationHandler.Factory
terminationHandler

The termination handler to use.

protected final Assigner.Typing
typing

Indicates if dynamic type castings should be attempted for incompatible assignments.

Constructor Summary

AccessConstructor and Description
protected
MethodCall(MethodCall.MethodLocator.Factory
The method locator to use.
methodLocator
,
MethodCall.TargetHandler.Factory
The target handler to use.
targetHandler
,
List<MethodCall.ArgumentLoader.Factory>
The argument loader to load arguments onto the operand stack in their application order.
argumentLoaders
,
MethodCall.MethodInvoker.Factory
The method invoker to use.
methodInvoker
,
MethodCall.TerminationHandler.Factory
The termination handler to use.
terminationHandler
,
Assigner
The assigner to use.
assigner
,
Assigner.Typing
Indicates if dynamic type castings should be attempted for incompatible assignments.
typing
)

Creates a new method call implementation.

Method Summary

Modifier and TypeMethod and Description
public Implementation
andThen(Implementation
The subsequent implementation.
implementation
)

Implements org.easymock.bytebuddy.implementation.Implementation.Composable.andThen.

Appends the supplied implementation to this implementation.
public Implementation.Composable
andThen(Implementation.Composable
The subsequent composable implementation.
implementation
)

Implements org.easymock.bytebuddy.implementation.Implementation.Composable.andThen.

Appends the supplied composable implementation to this implementation.
public ByteCodeAppender
appender(Implementation.Target
The target of the current implementation.
implementationTarget
)

Implements org.easymock.bytebuddy.implementation.Implementation.appender.

Creates a byte code appender that determines the implementation of the instrumented type's methods.
public static Implementation.Composable

Returns:

A composable method implementation that invokes the given callable.
call
(Callable<?>
The callable to invoke when a method is intercepted.
callable
)

Implements a method by invoking the provided Callable.

public static MethodCall

Returns:

A method call that invokes the given constructor without providing any arguments.
construct
(Constructor<?>
The constructor to invoke.
constructor
)

Invokes the given constructor in order to create an instance.

public static MethodCall

Returns:

A method call that invokes the given constructor without providing any arguments.
construct
(MethodDescription
A description of the constructor to invoke.
methodDescription
)

Invokes the given constructor in order to create an instance.

public static MethodCall.WithoutSpecifiedTarget

Returns:

A method call implementation that invokes the given method without providing any arguments.
invoke
(Method
The method to invoke.
method
)

Invokes the given method.

public static MethodCall.WithoutSpecifiedTarget

Returns:

A method call implementation that invokes the given constructor without providing any arguments.
invoke
(Constructor<?>
The constructor to invoke.
constructor
)

Invokes the given constructor on the instance of the instrumented type.

public static MethodCall.WithoutSpecifiedTarget

Returns:

A method call implementation that invokes the given method without providing any arguments.
invoke
(MethodDescription
The method to invoke.
methodDescription
)

Invokes the given method.

public static MethodCall.WithoutSpecifiedTarget

Returns:

A method call for the uniquely identified method.
invoke
(ElementMatcher<? super MethodDescription>
The matcher to identify the method to invoke.
matcher
)

Invokes a unique virtual method or constructor of the instrumented type that is matched by the specified matcher.

public static MethodCall.WithoutSpecifiedTarget

Returns:

A method call for the uniquely identified method.
invoke
(ElementMatcher<? super MethodDescription>
The matcher to identify the method to invoke.
matcher
,
MethodGraph.Compiler
The method graph compiler to use.
methodGraphCompiler
)

Invokes a unique virtual method or constructor of the instrumented type that is matched by the specified matcher.

public static MethodCall.WithoutSpecifiedTarget

Returns:

A method call implementation that uses the provided method locator for resolving the method to be invoked.
invoke
(MethodCall.MethodLocator.Factory
The method locator to apply for locating the method to invoke given the instrumented method.
methodLocator
)

Invokes a method using the provided method locator.

public static MethodCall.WithoutSpecifiedTarget

Returns:

A method call that invokes the method being instrumented.
invokeSelf
()

Invokes the instrumented method recursively.

public static MethodCall

Returns:

A method call that invokes the method being instrumented as a super method call.
invokeSuper
()

Invokes the instrumented method as a super method call on the instance itself.

public InstrumentedType
prepare(InstrumentedType
The instrumented type in its current form.
instrumentedType
)

Implements org.easymock.bytebuddy.dynamic.scaffold.InstrumentedType.Prepareable.prepare.

Prepares a given instrumented type.
public static Implementation.Composable

Returns:

A composable method implementation that invokes the given runnable.
run
(Runnable
The runnable to invoke when a method is intercepted.
runnable
)

Implements a method by invoking the provided Runnable.

public MethodCall.FieldSetting

Returns:

A new instance of this method call that sets the resulting value as the specified field's value.
setsField
(Field
The field to set.
field
)

Sets the result of the method call as a value of the specified field.

public MethodCall.FieldSetting

Returns:

A new instance of this method call that sets the resulting value as the specified field's value.
setsField
(FieldDescription
The field to set.
fieldDescription
)

Sets the result of the method call as a value of the specified field.

public MethodCall.FieldSetting

Returns:

A new instance of this method call that sets the resulting value as the specified field's value.
setsField
(ElementMatcher<? super FieldDescription>
A matcher that locates a field in the instrumented type's hierarchy.
matcher
)

Sets the result of the method call as a value of the specified field.

public MethodCall

Returns:

A method call that hands the provided arguments to the invoked method.
with
(Object...
The arguments to provide to the method that is being called in their order.
argument
)

Defines a number of arguments to be handed to the method that is being invoked by this implementation.

public MethodCall

Returns:

A method call that hands the provided arguments to the invoked method.
with
(TypeDescription...
The type descriptions to provide as arguments.
typeDescription
)

Defines the given types to be provided as arguments to the invoked method where the represented types are stored in the generated class's constant pool.

public MethodCall

Returns:

A method call that hands the provided arguments to the invoked method.
with
(EnumerationDescription...
The enumeration descriptions to provide as arguments.
enumerationDescription
)

Defines the given enumeration values to be provided as arguments to the invoked method where the values are read from the enumeration class on demand.

public MethodCall

Returns:

A method call that hands the provided arguments to the invoked method.
with
(ConstantValue...
The constants to provide as arguments.
constant
)

Defines the given Java instances to be provided as arguments to the invoked method where the given instances are stored in the generated class's constant pool.

public MethodCall

Returns:

A method call that hands the provided arguments to the invoked method.
with
(JavaConstant...
The constants to provide as arguments.
constant
)

Defines the given Java instances to be provided as arguments to the invoked method where the given instances are stored in the generated class's constant pool.

public MethodCall

Returns:

A method call that adds the stack manipulation as the next argument to the invoked method.
with
(StackManipulation
The stack manipulation loading the value.
stackManipulation
,
Type
The type of the argument being loaded.
type
)

Adds a stack manipulation as an assignment to the next parameter.

public MethodCall

Returns:

A method call that adds the stack manipulation as the next argument to the invoked method.
with
(StackManipulation
The stack manipulation loading the value.
stackManipulation
,
TypeDefinition
The type of the argument being loaded.
typeDefinition
)

Adds a stack manipulation as an assignment to the next parameter.

public MethodCall

Returns:

A method call that adds the arguments of the supplied argument loaders to the invoked method.
with
(MethodCall.ArgumentLoader.Factory...
The argument loaders to apply to the subsequent arguments of the
argumentLoader
)

Defines a method call that resolves arguments by the supplied argument loader factories.

public MethodCall

Returns:

A method call that adds the arguments of the supplied argument loaders to the invoked method.
with
(List<? extends MethodCall.ArgumentLoader.Factory>
The argument loaders to apply to the subsequent arguments of the
argumentLoaders
)

Defines a method call that resolves arguments by the supplied argument loader factories.

public MethodCall

Returns:

A method call that hands all arguments of the instrumented method to the invoked method.
withAllArguments
()

Adds all arguments of the instrumented method as arguments to the invoked method to this method call.

public MethodCall

Returns:

A method call that hands the provided arguments to the invoked method.
withArgument
(int...
The parameter indices of the instrumented method to be handed to the invoked method as an argument in their order. The indices are zero-based.
index
)

Defines a number of arguments of the instrumented method by their parameter indices to be handed to the invoked method as an argument.

public MethodCall

Returns:

A method call that adds an array containing all arguments of the instrumented method to the invoked method.
withArgumentArray
()

Adds an array containing all arguments of the instrumented method to this method call.

public MethodCall

Returns:

A method call that loads size elements from the array handed to the instrumented method as argument index.
withArgumentArrayElements
(int
The index of the parameter.
index
)

Creates a method call where the parameter with index is expected to be an array and where each element of the array is expected to represent an argument for the method being invoked.

public MethodCall

Returns:

A method call that loads size elements from the array handed to the instrumented method as argument index.
withArgumentArrayElements
(int
The index of the parameter.
index
,
int
The amount of elements to load from the array.
size
)

Creates a method call where the parameter with index is expected to be an array and where size elements are loaded from the array as arguments for the invoked method.

public MethodCall

Returns:

A method call that loads size elements from the array handed to the instrumented method as argument index.
withArgumentArrayElements
(int
The index of the parameter.
index
,
int
The first array index to consider.
start
,
int
The amount of elements to load from the array with increasing index from start.
size
)

Creates a method call where the parameter with index is expected to be an array and where size elements are loaded from the array as arguments for the invoked method.

public Implementation.Composable

Returns:

This method call using the provided assigner.
withAssigner
(Assigner
The assigner to use.
assigner
,
Assigner.Typing
Indicates if dynamic type castings should be attempted for incompatible assignments.
typing
)

Defines an assigner to be used for assigning values to the parameters of the invoked method.

public MethodCall

Returns:

A method call which assigns the next parameters to the values of the given fields.
withField
(String...
The names of the fields.
name
)

Defines a method call which fetches a value from a list of existing fields.

public MethodCall

Returns:

A method call which assigns the next parameters to the values of the given fields.
withField
(FieldLocator.Factory
The field locator factory to use.
fieldLocatorFactory
,
String...
The names of the fields.
name
)

Defines a method call which fetches a value from a list of existing fields.

public MethodCall

Returns:

A method call which assigns the parameter to the result of the given method call.
withMethodCall
(MethodCall
The method call to use.
methodCall
)

Defines a method call which fetches a value from a method call.

public MethodCall

Returns:

This method call where the next parameter is a assigned a reference to the java.lang.Class value of the instrumented type.
withOwnType
()

Assigns the java.lang.Class value of the instrumented type.

public MethodCall

Returns:

A method call that hands the provided arguments to the invoked method.
withReference
(Object...
The arguments to provide to the method that is being called in their order.
argument
)

Defines a number of arguments to be handed to the method that is being invoked by this implementation.

public MethodCall

Returns:

This method call where the next parameter is a assigned a reference to the this reference of the instance of the intercepted method.
withThis
()

Assigns the this reference to the next parameter.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait