Package net.bytebuddy.implementation
Class MethodCall.WithoutSpecifiedTarget
java.lang.Object
net.bytebuddy.implementation.MethodCall
net.bytebuddy.implementation.MethodCall.WithoutSpecifiedTarget
- All Implemented Interfaces:
InstrumentedType.Prepareable
,Implementation
,Implementation.Composable
- Enclosing class:
MethodCall
Represents a
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.-
Nested Class Summary
Nested classes/interfaces inherited from class net.bytebuddy.implementation.MethodCall
MethodCall.Appender, MethodCall.ArgumentLoader, MethodCall.FieldSetting, MethodCall.MethodInvoker, MethodCall.MethodLocator, MethodCall.TargetHandler, MethodCall.TerminationHandler, MethodCall.WithoutSpecifiedTarget
Nested classes/interfaces inherited from interface net.bytebuddy.implementation.Implementation
Implementation.Composable, Implementation.Compound, Implementation.Context, Implementation.Simple, Implementation.SpecialMethodInvocation, Implementation.Target
Nested classes/interfaces inherited from interface net.bytebuddy.dynamic.scaffold.InstrumentedType.Prepareable
InstrumentedType.Prepareable.NoOp
-
Field Summary
Fields inherited from class net.bytebuddy.implementation.MethodCall
argumentLoaders, assigner, methodInvoker, methodLocator, targetHandler, terminationHandler, typing
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
WithoutSpecifiedTarget
(MethodCall.MethodLocator.Factory methodLocator) Creates a new method call without a specified target. -
Method Summary
Modifier and TypeMethodDescriptionInvokes the specified method on the given instance.on
(StackManipulation stackManipulation, Class<?> type) Invokes the specified method on an instance that is loaded by the provided stack manipulation.on
(StackManipulation stackManipulation, TypeDescription typeDescription) Invokes the specified method on an instance that is loaded by the provided stack manipulation.<T> MethodCall
Invokes the specified method on the given instance.onArgument
(int index) Invokes the specified method on the instrumented method's argument of the given index.Invokes the given method by a Java 8 default method invocation on the instance of the instrumented type.Invokes a method on the object stored in the specified field.Invokes a method on the object stored in the specified field.onField
(String name, FieldLocator.Factory fieldLocatorFactory) Invokes a method on the object stored in the specified field.onField
(FieldDescription fieldDescription) Invokes a method on the object stored in the specified field.onMethodCall
(MethodCall methodCall) Invokes a method on the method call's return value.onSuper()
Invokes the given method by a super method invocation on the instance of the instrumented type.Methods inherited from class net.bytebuddy.implementation.MethodCall
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, with, withAllArguments, withArgument, withArgumentArray, withArgumentArrayElements, withArgumentArrayElements, withArgumentArrayElements, withAssigner, withField, withField, withMethodCall, withOwnType, withReference, withThis
-
Constructor Details
-
WithoutSpecifiedTarget
Creates a new method call without a specified target.- Parameters:
methodLocator
- The method locator to use.
-
-
Method Details
-
on
Invokes the specified method on the given instance.- Parameters:
target
- The object on which the method is to be invoked upon.- Returns:
- A method call that invokes the provided method on the given object.
-
on
Invokes the specified method on the given instance.- Type Parameters:
T
- The type of the object.- Parameters:
target
- The object on which the method is to be invoked upon.type
- The object's type.- Returns:
- A method call that invokes the provided method on the given object.
-
on
Invokes the specified method on an instance that is loaded by the provided stack manipulation.- Parameters:
stackManipulation
- The stack manipulation that loads the instance that the method is invoked upon.type
- The type of the loaded instance.- Returns:
- A method call that invokes the provided method on the value of the provided stack manipulation.
-
on
Invokes the specified method on an instance that is loaded by the provided stack manipulation.- Parameters:
stackManipulation
- The stack manipulation that loads the instance that the method is invoked upon.typeDescription
- The type of the loaded instance.- Returns:
- A method call that invokes the provided method on the value of the provided stack manipulation.
-
onArgument
Invokes the specified method on the instrumented method's argument of the given index.- Parameters:
index
- The index of the method's argument on which the specified method should be invoked.- Returns:
- A method call that invokes the provided method on the given method argument.
-
onField
Invokes a method on the object stored in the specified field.- Parameters:
name
- The name of the field.- Returns:
- A method call that invokes the given method on an instance that is read from a field.
-
onField
Invokes a method on the object stored in the specified field.- Parameters:
name
- The name of the field.fieldLocatorFactory
- The field locator factory to use for locating the field.- Returns:
- A method call that invokes the given method on an instance that is read from a field.
-
onField
Invokes a method on the object stored in the specified field.- Parameters:
field
- The field on which to invoke the method upon.- Returns:
- A method call that invokes the given method on an instance that is read from a field.
-
onField
Invokes a method on the object stored in the specified field.- Parameters:
fieldDescription
- The field on which to invoke the method upon.- Returns:
- A method call that invokes the given method on an instance that is read from a field.
-
onMethodCall
Invokes a method on the method call's return value.- Parameters:
methodCall
- The method call that return's value is to be used in this method call- Returns:
- A method call that invokes the given method on an instance that is returned from a method call.
-
onSuper
Invokes the given method by a super method invocation on the instance of the instrumented type. Note that the super method is resolved depending on the type of implementation when this method is called. In case that a subclass is created, the super type is invoked. If a type is rebased, the rebased method is invoked if such a method exists.- Returns:
- A method call where the given method is invoked as a super method invocation.
-
onDefault
Invokes the given method by a Java 8 default method invocation on the instance of the instrumented type.- Returns:
- A method call where the given method is invoked as a super method invocation.
-