Class InvokeDynamic
- java.lang.Object
-
- net.bytebuddy.implementation.InvokeDynamic
-
- All Implemented Interfaces:
InstrumentedType.Prepareable
,Implementation
,Implementation.Composable
- Direct Known Subclasses:
InvokeDynamic.AbstractDelegator
@Enhance public class InvokeDynamic extends java.lang.Object implements Implementation.Composable
An implementation that applies a dynamic method invocation.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static class
InvokeDynamic.AbstractDelegator
An abstract delegator that allows to specify a configuration for any specification of an argument.protected class
InvokeDynamic.Appender
The byte code appender to be used by theInvokeDynamic
implementation.protected static interface
InvokeDynamic.InvocationProvider
An invocation provider is responsible for loading the arguments of the invoked method onto the operand stack and for creating the actual invoke dynamic instruction.protected static class
InvokeDynamic.TerminationHandler
A termination handler is responsible to handle the return value of a method that is invoked via aInvokeDynamic
.static class
InvokeDynamic.WithImplicitArguments
Representation of anInvokeDynamic
implementation where the bootstrapped method is passed athis
reference, if available, and any arguments of the instrumented method.static class
InvokeDynamic.WithImplicitTarget
Representation of anInvokeDynamic
implementation where the bootstrapped method is passed athis
reference, if available, and any arguments of the instrumented method and where the invocation target is implicit.static class
InvokeDynamic.WithImplicitType
AnInvokeDynamic
invocation where the last argument is assigned its implicit type.-
Nested classes/interfaces inherited from interface net.bytebuddy.implementation.Implementation
Implementation.Composable, Implementation.Compound, Implementation.Context, Implementation.Simple, Implementation.SpecialMethodInvocation, Implementation.Target
-
-
Field Summary
Fields Modifier and Type Field Description protected java.util.List<?>
arguments
The arguments that are provided to the bootstrap method.protected Assigner
assigner
The assigner to be used.protected MethodDescription.InDefinedShape
bootstrap
The bootstrap method.protected InvokeDynamic.InvocationProvider
invocationProvider
The target provided that identifies the method to be bootstrapped.protected InvokeDynamic.TerminationHandler
terminationHandler
A handler that handles the method return.protected Assigner.Typing
typing
Indicates if dynamic type castings should be attempted for incompatible assignments.
-
Constructor Summary
Constructors Modifier Constructor Description protected
InvokeDynamic(MethodDescription.InDefinedShape bootstrap, java.util.List<?> arguments, InvokeDynamic.InvocationProvider invocationProvider, InvokeDynamic.TerminationHandler terminationHandler, Assigner assigner, Assigner.Typing typing)
Creates a new invoke dynamic implementation.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Implementation
andThen(Implementation implementation)
Appends the supplied implementation to this implementation.Implementation.Composable
andThen(Implementation.Composable implementation)
Appends the supplied composable implementation to this implementation.ByteCodeAppender
appender(Implementation.Target implementationTarget)
Creates a byte code appender that determines the implementation of the instrumented type's methods.static InvokeDynamic.WithImplicitTarget
bootstrap(java.lang.reflect.Constructor<?> constructor, java.lang.Object... constant)
Implements the instrumented method with a dynamic method invocation which is linked at runtime using the specified bootstrap constructor.static InvokeDynamic.WithImplicitTarget
bootstrap(java.lang.reflect.Constructor<?> constructor, java.util.List<?> constants)
Implements the instrumented method with a dynamic method invocation which is linked at runtime using the specified bootstrap constructor.static InvokeDynamic.WithImplicitTarget
bootstrap(java.lang.reflect.Method method, java.lang.Object... constant)
Implements the instrumented method with a dynamic method invocation which is linked at runtime using the specified bootstrap method.static InvokeDynamic.WithImplicitTarget
bootstrap(java.lang.reflect.Method method, java.util.List<?> constants)
Implements the instrumented method with a dynamic method invocation which is linked at runtime using the specified bootstrap method.static InvokeDynamic.WithImplicitTarget
bootstrap(MethodDescription.InDefinedShape bootstrap, java.lang.Object... constant)
Implements the instrumented method with a dynamic method invocation which is linked at runtime using the specified bootstrap method or constructor.static InvokeDynamic.WithImplicitTarget
bootstrap(MethodDescription.InDefinedShape bootstrap, java.util.List<?> constants)
Implements the instrumented method with a dynamic method invocation which is linked at runtime using the specified bootstrap method or constructor.static InvokeDynamic.WithImplicitArguments
lambda(java.lang.reflect.Method method, java.lang.Class<?> functionalInterface)
Creates a lambda expression using the JVM's lambda meta factory.static InvokeDynamic.WithImplicitArguments
lambda(java.lang.reflect.Method method, java.lang.Class<?> functionalInterface, MethodGraph.Compiler methodGraphCompiler)
Creates a lambda expression using the JVM's lambda meta factory.static InvokeDynamic.WithImplicitArguments
lambda(MethodDescription.InDefinedShape methodDescription, TypeDescription functionalInterface)
Creates a lambda expression using the JVM's lambda meta factory.static InvokeDynamic.WithImplicitArguments
lambda(MethodDescription.InDefinedShape methodDescription, TypeDescription functionalInterface, MethodGraph.Compiler methodGraphCompiler)
Creates a lambda expression using the JVM's lambda meta factory.InstrumentedType
prepare(InstrumentedType instrumentedType)
Prepares a given instrumented type.InvokeDynamic.WithImplicitType
withArgument(int index)
Passes a parameter of the instrumented method to the bootstrapped method.InvokeDynamic
withArgument(int... index)
Passes parameters of the instrumented method to the bootstrapped method.Implementation.Composable
withAssigner(Assigner assigner, Assigner.Typing typing)
Instructs this implementation to use the provided assigner and decides if the assigner should apply dynamic typing.InvokeDynamic
withBooleanValue(boolean... value)
Requires the bootstrap method to bootstrap a method that takes the specifiedboolean
arguments as its next parameters.InvokeDynamic
withByteValue(byte... value)
Requires the bootstrap method to bootstrap a method that takes the specifiedbyte
arguments as its next parameters.InvokeDynamic
withCharacterValue(char... value)
Requires the bootstrap method to bootstrap a method that takes the specifiedchar
arguments as its next parameters.InvokeDynamic
withDoubleValue(double... value)
Requires the bootstrap method to bootstrap a method that takes the specifieddouble
arguments as its next parameters.InvokeDynamic
withEnumeration(EnumerationDescription... enumerationDescription)
Hands the provided enumerations to the dynamically bound method.InvokeDynamic.WithImplicitType
withField(java.lang.String name)
Passes the values of the specified fields to the bootstrap method.InvokeDynamic
withField(java.lang.String... name)
Passes the values of the specified fields to the bootstrap method.InvokeDynamic.WithImplicitType
withField(java.lang.String name, FieldLocator.Factory fieldLocatorFactory)
Passes the values of the specified fields to the bootstrap method.InvokeDynamic
withField(FieldLocator.Factory fieldLocatorFactory, java.lang.String... name)
Passes the values of the specified fields to the bootstrap method.InvokeDynamic
withFloatValue(float... value)
Requires the bootstrap method to bootstrap a method that takes the specifiedfloat
arguments as its next parameters.InvokeDynamic
withImplicitAndMethodArguments()
Adds a potentialthis
reference and all method arguments to the the bootstrapped method.InvokeDynamic
withInstance(JavaConstant... javaConstant)
Hands the provided Java instance to the dynamically bound method.InvokeDynamic
withIntegerValue(int... value)
Requires the bootstrap method to bootstrap a method that takes the specifiedint
arguments as its next parameters.InvokeDynamic
withLongValue(long... value)
Requires the bootstrap method to bootstrap a method that takes the specifiedlong
arguments as its next parameters.InvokeDynamic
withMethodArguments()
Adds all method arguments to the the bootstrapped method.InvokeDynamic
withNullValue(java.lang.Class<?>... type)
Passesnull
values of the given types to the bootstrapped method.InvokeDynamic
withNullValue(TypeDescription... typeDescription)
Passesnull
values of the given types to the bootstrapped method.InvokeDynamic.WithImplicitType
withReference(java.lang.Object value)
Requires the bootstrap method to bootstrap a method that takes the specified argument as its next parameter while allowing to specify the value to be of a different type than the actual instance type.InvokeDynamic
withReference(java.lang.Object... value)
Requires the bootstrap method to bootstrap a method that takes the specified arguments as its next parameters.InvokeDynamic
withShortValue(short... value)
Requires the bootstrap method to bootstrap a method that takes the specifiedshort
arguments as its next parameters.InvokeDynamic
withThis(java.lang.Class<?>... type)
Passes references tothis
onto the operand stack where the instance is represented as the given types.InvokeDynamic
withThis(TypeDescription... typeDescription)
Passes references tothis
onto the operand stack where the instance is represented as the given types.InvokeDynamic
withType(TypeDescription... typeDescription)
Hands the provided types to the dynamically bound method.InvokeDynamic
withValue(java.lang.Object... value)
Requires the bootstrap method to bootstrap a method that takes the specified arguments as its next parameters.
-
-
-
Field Detail
-
bootstrap
protected final MethodDescription.InDefinedShape bootstrap
The bootstrap method.
-
arguments
protected final java.util.List<?> arguments
The arguments that are provided to the bootstrap method.
-
invocationProvider
protected final InvokeDynamic.InvocationProvider invocationProvider
The target provided that identifies the method to be bootstrapped.
-
terminationHandler
protected final InvokeDynamic.TerminationHandler terminationHandler
A handler that handles the method return.
-
assigner
protected final Assigner assigner
The assigner to be used.
-
typing
protected final Assigner.Typing typing
Indicates if dynamic type castings should be attempted for incompatible assignments.
-
-
Constructor Detail
-
InvokeDynamic
protected InvokeDynamic(MethodDescription.InDefinedShape bootstrap, java.util.List<?> arguments, InvokeDynamic.InvocationProvider invocationProvider, InvokeDynamic.TerminationHandler terminationHandler, Assigner assigner, Assigner.Typing typing)
Creates a new invoke dynamic implementation.- Parameters:
bootstrap
- The bootstrap method.arguments
- The arguments that are provided to the bootstrap method.invocationProvider
- The target provided that identifies the method to be bootstrapped.terminationHandler
- A handler that handles the method return.assigner
- The assigner to be used.typing
- Indicates if dynamic type castings should be attempted for incompatible assignments.
-
-
Method Detail
-
bootstrap
public static InvokeDynamic.WithImplicitTarget bootstrap(java.lang.reflect.Method method, java.lang.Object... constant)
Implements the instrumented method with a dynamic method invocation which is linked at runtime using the specified bootstrap method.- Parameters:
method
- The bootstrap method that is used to link the instrumented method.constant
- The constant values passed to the bootstrap method. Values can be represented either asTypeDescription
, asJavaConstant
, asString
or a primitiveint
,long
,float
ordouble
represented as wrapper type.- Returns:
- An implementation where a
this
reference, if available, and all arguments of the instrumented method are passed to the bootstrapped method unless explicit parameters are specified.
-
bootstrap
public static InvokeDynamic.WithImplicitTarget bootstrap(java.lang.reflect.Method method, java.util.List<?> constants)
Implements the instrumented method with a dynamic method invocation which is linked at runtime using the specified bootstrap method.- Parameters:
method
- The bootstrap method that is used to link the instrumented method.constants
- The constant values passed to the bootstrap method. Values can be represented either asTypeDescription
, asJavaConstant
, asString
or a primitiveint
,long
,float
ordouble
represented as wrapper type.- Returns:
- An implementation where a
this
reference, if available, and all arguments of the instrumented method are passed to the bootstrapped method unless explicit parameters are specified.
-
bootstrap
public static InvokeDynamic.WithImplicitTarget bootstrap(java.lang.reflect.Constructor<?> constructor, java.lang.Object... constant)
Implements the instrumented method with a dynamic method invocation which is linked at runtime using the specified bootstrap constructor.- Parameters:
constructor
- The bootstrap constructor that is used to link the instrumented method.constant
- The constant values passed to the bootstrap method. Values can be represented either asTypeDescription
, asJavaConstant
, asString
or a primitiveint
,long
,float
ordouble
represented as wrapper type.- Returns:
- An implementation where a
this
reference, if available, and all arguments of the instrumented method are passed to the bootstrapped method unless explicit parameters are specified.
-
bootstrap
public static InvokeDynamic.WithImplicitTarget bootstrap(java.lang.reflect.Constructor<?> constructor, java.util.List<?> constants)
Implements the instrumented method with a dynamic method invocation which is linked at runtime using the specified bootstrap constructor.- Parameters:
constructor
- The bootstrap constructor that is used to link the instrumented method.constants
- The constant values passed to the bootstrap method. Values can be represented either asTypeDescription
, asJavaConstant
, asString
or a primitiveint
,long
,float
ordouble
represented as wrapper type.- Returns:
- An implementation where a
this
reference, if available, and all arguments of the instrumented method are passed to the bootstrapped method unless explicit parameters are specified.
-
bootstrap
public static InvokeDynamic.WithImplicitTarget bootstrap(MethodDescription.InDefinedShape bootstrap, java.lang.Object... constant)
Implements the instrumented method with a dynamic method invocation which is linked at runtime using the specified bootstrap method or constructor.- Parameters:
bootstrap
- The bootstrap method or constructor that is used to link the instrumented method.constant
- The constant values passed to the bootstrap method. Values can be represented either asTypeDescription
, asJavaConstant
, asString
or a primitiveint
,long
,float
ordouble
represented as wrapper type.- Returns:
- An implementation where a
this
reference, if available, and all arguments of the instrumented method are passed to the bootstrapped method unless explicit parameters are specified.
-
bootstrap
public static InvokeDynamic.WithImplicitTarget bootstrap(MethodDescription.InDefinedShape bootstrap, java.util.List<?> constants)
Implements the instrumented method with a dynamic method invocation which is linked at runtime using the specified bootstrap method or constructor.- Parameters:
bootstrap
- The bootstrap method or constructor that is used to link the instrumented method.constants
- The constant values passed to the bootstrap method. Values can be represented either asTypeDescription
, asJavaConstant
, asString
or a primitiveint
,long
,float
ordouble
represented as wrapper type.- Returns:
- An implementation where a
this
reference, if available, and all arguments of the instrumented method are passed to the bootstrapped method unless explicit parameters are specified.
-
lambda
public static InvokeDynamic.WithImplicitArguments lambda(java.lang.reflect.Method method, java.lang.Class<?> functionalInterface)
Creates a lambda expression using the JVM's lambda meta factory. The method that is implementing the lambda expression is provided the explicit arguments first and the functional interface's method second.
Important: Byte Buddy does not validate that the provided arguments are correct considering the required arguments of the bound functional interface. Binding an incorrect number of arguments or arguments of incompatible types does not create illegal byte code but yields a runtime error when the call site is first used. This is done to support future extensions or alternative implementations of the Java virtual machine.
- Parameters:
method
- The method that implements the lambda expression.functionalInterface
- The functional interface that is an instance of the lambda expression.- Returns:
- A builder for creating a lambda expression.
-
lambda
public static InvokeDynamic.WithImplicitArguments lambda(java.lang.reflect.Method method, java.lang.Class<?> functionalInterface, MethodGraph.Compiler methodGraphCompiler)
Creates a lambda expression using the JVM's lambda meta factory. The method that is implementing the lambda expression is provided the explicit arguments first and the functional interface's method second.
Important: Byte Buddy does not validate that the provided arguments are correct considering the required arguments of the bound functional interface. Binding an incorrect number of arguments or arguments of incompatible types does not create illegal byte code but yields a runtime error when the call site is first used. This is done to support future extensions or alternative implementations of the Java virtual machine.
- Parameters:
method
- The method that implements the lambda expression.functionalInterface
- The functional interface that is an instance of the lambda expression.methodGraphCompiler
- The method graph compiler to use.- Returns:
- A builder for creating a lambda expression.
-
lambda
public static InvokeDynamic.WithImplicitArguments lambda(MethodDescription.InDefinedShape methodDescription, TypeDescription functionalInterface)
Creates a lambda expression using the JVM's lambda meta factory. The method that is implementing the lambda expression is provided the explicit arguments first and the functional interface's method second.
Important: Byte Buddy does not validate that the provided arguments are correct considering the required arguments of the bound functional interface. Binding an incorrect number of arguments or arguments of incompatible types does not create illegal byte code but yields a runtime error when the call site is first used. This is done to support future extensions or alternative implementations of the Java virtual machine.
- Parameters:
methodDescription
- The method that implements the lambda expression.functionalInterface
- The functional interface that is an instance of the lambda expression.- Returns:
- A builder for creating a lambda expression.
-
lambda
public static InvokeDynamic.WithImplicitArguments lambda(MethodDescription.InDefinedShape methodDescription, TypeDescription functionalInterface, MethodGraph.Compiler methodGraphCompiler)
Creates a lambda expression using the JVM's lambda meta factory. The method that is implementing the lambda expression is provided the explicit arguments first and the functional interface's method second.
Important: Byte Buddy does not validate that the provided arguments are correct considering the required arguments of the bound functional interface. Binding an incorrect number of arguments or arguments of incompatible types does not create illegal byte code but yields a runtime error when the call site is first used. This is done to support future extensions or alternative implementations of the Java virtual machine.
- Parameters:
methodDescription
- The method that implements the lambda expression.functionalInterface
- The functional interface that is an instance of the lambda expression.methodGraphCompiler
- The method graph compiler to use.- Returns:
- A builder for creating a lambda expression.
-
withBooleanValue
public InvokeDynamic withBooleanValue(boolean... value)
Requires the bootstrap method to bootstrap a method that takes the specifiedboolean
arguments as its next parameters.- Parameters:
value
- The arguments to pass to the bootstrapped method.- Returns:
- This invoke dynamic implementation where the bootstrapped method is passed the specified arguments.
-
withByteValue
public InvokeDynamic withByteValue(byte... value)
Requires the bootstrap method to bootstrap a method that takes the specifiedbyte
arguments as its next parameters.- Parameters:
value
- The arguments to pass to the bootstrapped method.- Returns:
- This invoke dynamic implementation where the bootstrapped method is passed the specified arguments.
-
withShortValue
public InvokeDynamic withShortValue(short... value)
Requires the bootstrap method to bootstrap a method that takes the specifiedshort
arguments as its next parameters.- Parameters:
value
- The arguments to pass to the bootstrapped method.- Returns:
- This invoke dynamic implementation where the bootstrapped method is passed the specified arguments.
-
withCharacterValue
public InvokeDynamic withCharacterValue(char... value)
Requires the bootstrap method to bootstrap a method that takes the specifiedchar
arguments as its next parameters.- Parameters:
value
- The arguments to pass to the bootstrapped method.- Returns:
- This invoke dynamic implementation where the bootstrapped method is passed the specified arguments.
-
withIntegerValue
public InvokeDynamic withIntegerValue(int... value)
Requires the bootstrap method to bootstrap a method that takes the specifiedint
arguments as its next parameters.- Parameters:
value
- The arguments to pass to the bootstrapped method.- Returns:
- This invoke dynamic implementation where the bootstrapped method is passed the specified arguments.
-
withLongValue
public InvokeDynamic withLongValue(long... value)
Requires the bootstrap method to bootstrap a method that takes the specifiedlong
arguments as its next parameters.- Parameters:
value
- The arguments to pass to the bootstrapped method.- Returns:
- This invoke dynamic implementation where the bootstrapped method is passed the specified arguments.
-
withFloatValue
public InvokeDynamic withFloatValue(float... value)
Requires the bootstrap method to bootstrap a method that takes the specifiedfloat
arguments as its next parameters.- Parameters:
value
- The arguments to pass to the bootstrapped method.- Returns:
- This invoke dynamic implementation where the bootstrapped method is passed the specified arguments.
-
withDoubleValue
public InvokeDynamic withDoubleValue(double... value)
Requires the bootstrap method to bootstrap a method that takes the specifieddouble
arguments as its next parameters.- Parameters:
value
- The arguments to pass to the bootstrapped method.- Returns:
- This invoke dynamic implementation where the bootstrapped method is passed the specified arguments.
-
withValue
public InvokeDynamic withValue(java.lang.Object... value)
Requires the bootstrap method to bootstrap a method that takes the specified arguments as its next parameters. Note that any primitive parameters are passed as their wrapper types. Furthermore, values that can be stored in the instrumented class's constant pool might be of different object identity when passed to the bootstrapped method or might not be visible to the the created class what later results in a runtime error.
- Parameters:
value
- The arguments to pass to the bootstrapped method.- Returns:
- This invoke dynamic implementation where the bootstrapped method is passed the specified arguments.
-
withReference
public InvokeDynamic.WithImplicitType withReference(java.lang.Object value)
Requires the bootstrap method to bootstrap a method that takes the specified argument as its next parameter while allowing to specify the value to be of a different type than the actual instance type.
- Parameters:
value
- The arguments to pass to the bootstrapped method.- Returns:
- This invoke dynamic implementation where the bootstrapped method is passed the specified arguments.
-
withReference
public InvokeDynamic withReference(java.lang.Object... value)
Requires the bootstrap method to bootstrap a method that takes the specified arguments as its next parameters. Note that any primitive parameters are passed as their wrapper types. Any value that is passed to the bootstrapped method is guaranteed to be of the same object identity.- Parameters:
value
- The arguments to pass to the bootstrapped method.- Returns:
- This invoke dynamic implementation where the bootstrapped method is passed the specified arguments.
-
withType
public InvokeDynamic withType(TypeDescription... typeDescription)
Hands the provided types to the dynamically bound method. The type is stored in the generated class's constant pool and is loaded at invocation time. For this to be possible, the created class's class loader must be able to see the provided type.- Parameters:
typeDescription
- The classes to provide to the bound method as an argument.- Returns:
- This invoke dynamic implementation where the bootstrapped method is passed the specified type.
-
withEnumeration
public InvokeDynamic withEnumeration(EnumerationDescription... enumerationDescription)
Hands the provided enumerations to the dynamically bound method. The enumeration values are read from the enumeration class on demand. For this to be possible, the created class's class loader must be able to see the enumeration type.- Parameters:
enumerationDescription
- The enumeration values to provide to the bound method as an argument.- Returns:
- This invoke dynamic implementation where the bootstrapped method is passed the specified enumerations.
-
withInstance
public InvokeDynamic withInstance(JavaConstant... javaConstant)
Hands the provided Java instance to the dynamically bound method. The instance is stored in the generated class's constant pool and is loaded at invocation time. For this to be possible, the created class's class loader must be able to create the provided Java instance.- Parameters:
javaConstant
- The Java instance to provide to the bound method as an argument.- Returns:
- This invoke dynamic implementation where the bootstrapped method is passed the specified Java instance.
-
withNullValue
public InvokeDynamic withNullValue(java.lang.Class<?>... type)
Passesnull
values of the given types to the bootstrapped method.- Parameters:
type
- The type that thenull
values should represent.- Returns:
- This invoke dynamic implementation where the bootstrapped method is passed the specified arguments.
-
withNullValue
public InvokeDynamic withNullValue(TypeDescription... typeDescription)
Passesnull
values of the given types to the bootstrapped method.- Parameters:
typeDescription
- The type that thenull
values should represent.- Returns:
- This invoke dynamic implementation where the bootstrapped method is passed the specified arguments.
-
withArgument
public InvokeDynamic withArgument(int... index)
Passes parameters of the instrumented method to the bootstrapped method.- Parameters:
index
- The indices of the parameters that should be passed to the bootstrapped method.- Returns:
- This invoke dynamic implementation where the bootstrapped method is passed the specified arguments.
-
withArgument
public InvokeDynamic.WithImplicitType withArgument(int index)
Passes a parameter of the instrumented method to the bootstrapped method.- Parameters:
index
- The index of the parameter that should be passed to the bootstrapped method.- Returns:
- This invoke dynamic implementation where the bootstrapped method is passed the specified argument with its implicit type.
-
withThis
public InvokeDynamic withThis(java.lang.Class<?>... type)
Passes references tothis
onto the operand stack where the instance is represented as the given types.- Parameters:
type
- The types as which thethis
reference of the intercepted method should be masked.- Returns:
- This implementation where
this
references are passed as the next arguments.
-
withThis
public InvokeDynamic withThis(TypeDescription... typeDescription)
Passes references tothis
onto the operand stack where the instance is represented as the given types.- Parameters:
typeDescription
- The types as which thethis
reference of the intercepted method should be masked.- Returns:
- This implementation where
this
references are passed as the next arguments.
-
withMethodArguments
public InvokeDynamic withMethodArguments()
Adds all method arguments to the the bootstrapped method.- Returns:
- This invoke dynamic implementation with all parameters of the instrumented method added.
-
withImplicitAndMethodArguments
public InvokeDynamic withImplicitAndMethodArguments()
Adds a potentialthis
reference and all method arguments to the the bootstrapped method.- Returns:
- This invoke dynamic implementation with a potential
this
reference and all parameters of the instrumented method added.
-
withField
public InvokeDynamic withField(java.lang.String... name)
Passes the values of the specified fields to the bootstrap method. Any of the specified fields must already exist for the instrumented type.- Parameters:
name
- The names of the fields to be passed to the bootstrapped method.- Returns:
- This invoke dynamic implementation where the bootstrapped method is passed the specified arguments.
-
withField
public InvokeDynamic withField(FieldLocator.Factory fieldLocatorFactory, java.lang.String... name)
Passes the values of the specified fields to the bootstrap method. Any of the specified fields must already exist for the instrumented type.- Parameters:
fieldLocatorFactory
- The field locator factory to use.name
- The names of the fields to be passed to the bootstrapped method.- Returns:
- This invoke dynamic implementation where the bootstrapped method is passed the specified arguments.
-
withField
public InvokeDynamic.WithImplicitType withField(java.lang.String name)
Passes the values of the specified fields to the bootstrap method. Any of the specified fields must already exist for the instrumented type.- Parameters:
name
- The names of the fields to be passed to the bootstrapped method.- Returns:
- This invoke dynamic implementation where the bootstrapped method is passed the specified arguments.
-
withField
public InvokeDynamic.WithImplicitType withField(java.lang.String name, FieldLocator.Factory fieldLocatorFactory)
Passes the values of the specified fields to the bootstrap method. Any of the specified fields must already exist for the instrumented type.- Parameters:
fieldLocatorFactory
- The field locator factory to use.name
- The names of the fields to be passed to the bootstrapped method.- Returns:
- This invoke dynamic implementation where the bootstrapped method is passed the specified arguments.
-
withAssigner
public Implementation.Composable withAssigner(Assigner assigner, Assigner.Typing typing)
Instructs this implementation to use the provided assigner and decides if the assigner should apply dynamic typing.- Parameters:
assigner
- The assigner to use.typing
-true
if the assigner should attempt dynamic typing.- Returns:
- The invoke dynamic instruction where the given assigner and dynamic-typing directive are applied.
-
andThen
public Implementation andThen(Implementation implementation)
Appends the supplied implementation to this implementation.- Specified by:
andThen
in interfaceImplementation.Composable
- Parameters:
implementation
- The subsequent implementation.- Returns:
- An implementation that combines this implementation with the provided one.
-
andThen
public Implementation.Composable andThen(Implementation.Composable implementation)
Appends the supplied composable implementation to this implementation.- Specified by:
andThen
in interfaceImplementation.Composable
- Parameters:
implementation
- The subsequent composable implementation.- Returns:
- A composable implementation that combines this implementation with the provided one.
-
prepare
public InstrumentedType prepare(InstrumentedType instrumentedType)
Prepares a given instrumented type.- Specified by:
prepare
in interfaceInstrumentedType.Prepareable
- Parameters:
instrumentedType
- The instrumented type in its current form.- Returns:
- The prepared instrumented type.
-
appender
public ByteCodeAppender appender(Implementation.Target implementationTarget)
Creates a byte code appender that determines the implementation of the instrumented type's methods.- Specified by:
appender
in interfaceImplementation
- Parameters:
implementationTarget
- The target of the current implementation.- Returns:
- A byte code appender for implementing methods delegated to this implementation. This byte code appender
is also responsible for handling methods that were added by this implementation on the call to
InstrumentedType.Prepareable.prepare(InstrumentedType)
.
-
-