public static class MethodCall.WithoutSpecifiedTarget extends MethodCall
MethodCall
that invokes a method without specifying
an invocation method. Some methods can for example be invoked both virtually or as a super method invocation.
Similarly, interface methods can be invoked virtually or as an explicit invocation of a default method. If
no explicit invocation type is set, a method is always invoked virtually unless the method
represents a static methods or a constructor.MethodCall.Appender, MethodCall.ArgumentLoader, MethodCall.FieldSetting, MethodCall.MethodInvoker, MethodCall.MethodLocator, MethodCall.TargetHandler, MethodCall.TerminationHandler, MethodCall.WithoutSpecifiedTarget
Implementation.Composable, Implementation.Compound, Implementation.Context, Implementation.Simple, Implementation.SpecialMethodInvocation, Implementation.Target
argumentLoaders, assigner, methodInvoker, methodLocator, targetHandler, terminationHandler, typing
Modifier | Constructor and Description |
---|---|
protected |
WithoutSpecifiedTarget(MethodCall.MethodLocator.Factory methodLocator)
Creates a new method call without a specified target.
|
Modifier and Type | Method and Description |
---|---|
MethodCall |
on(Object target)
Invokes the specified method on the given instance.
|
MethodCall |
on(StackManipulation stackManipulation,
Class<?> type)
Invokes the specified method on an instance that is loaded by the provided stack manipulation.
|
MethodCall |
on(StackManipulation stackManipulation,
TypeDescription typeDescription)
Invokes the specified method on an instance that is loaded by the provided stack manipulation.
|
<T> MethodCall |
on(T target,
Class<? super T> type)
Invokes the specified method on the given instance.
|
MethodCall |
onArgument(int index)
Invokes the specified method on the instrumented method's argument of the given index.
|
MethodCall |
onDefault()
Invokes the given method by a Java 8 default method invocation on the instance of the instrumented type.
|
MethodCall |
onField(Field field)
Invokes a method on the object stored in the specified field.
|
MethodCall |
onField(FieldDescription fieldDescription)
Invokes a method on the object stored in the specified field.
|
MethodCall |
onField(String name)
Invokes a method on the object stored in the specified field.
|
MethodCall |
onField(String name,
FieldLocator.Factory fieldLocatorFactory)
Invokes a method on the object stored in the specified field.
|
MethodCall |
onMethodCall(MethodCall methodCall)
Invokes a method on the method call's return value.
|
MethodCall |
onSuper()
Invokes the given method by a super method invocation on the instance of the instrumented type.
|
andThen, andThen, appender, call, construct, construct, invoke, invoke, invoke, invoke, invoke, invoke, invokeSelf, invokeSuper, prepare, run, setsField, setsField, setsField, with, with, with, with, with, with, with, with, withAllArguments, withArgument, withArgumentArray, withArgumentArrayElements, withArgumentArrayElements, withArgumentArrayElements, withAssigner, withField, withField, withMethodCall, withOwnType, withReference, withThis
protected WithoutSpecifiedTarget(MethodCall.MethodLocator.Factory methodLocator)
methodLocator
- The method locator to use.public MethodCall on(Object target)
target
- The object on which the method is to be invoked upon.public <T> MethodCall on(T target, Class<? super T> type)
T
- The type of the object.target
- The object on which the method is to be invoked upon.type
- The object's type.public MethodCall on(StackManipulation stackManipulation, Class<?> type)
stackManipulation
- The stack manipulation that loads the instance that the method is invoked upon.type
- The type of the loaded instance.public MethodCall on(StackManipulation stackManipulation, TypeDescription typeDescription)
stackManipulation
- The stack manipulation that loads the instance that the method is invoked upon.typeDescription
- The type of the loaded instance.public MethodCall onArgument(int index)
index
- The index of the method's argument on which the specified method should be invoked.public MethodCall onField(String name)
name
- The name of the field.public MethodCall onField(String name, FieldLocator.Factory fieldLocatorFactory)
name
- The name of the field.fieldLocatorFactory
- The field locator factory to use for locating the field.public MethodCall onField(Field field)
field
- The field on which to invoke the method upon.public MethodCall onField(FieldDescription fieldDescription)
fieldDescription
- The field on which to invoke the method upon.public MethodCall onMethodCall(MethodCall methodCall)
methodCall
- The method call that return's value is to be used in this method callpublic MethodCall onSuper()
public MethodCall onDefault()
Copyright © 2014–2020. All rights reserved.