Package net.bytebuddy.agent.builder
Class AgentBuilder.LambdaInstrumentationStrategy.LambdaInstanceFactory
java.lang.Object
net.bytebuddy.agent.builder.AgentBuilder.LambdaInstrumentationStrategy.LambdaInstanceFactory
- Enclosing class:
- AgentBuilder.LambdaInstrumentationStrategy
@Enhance
protected static class AgentBuilder.LambdaInstrumentationStrategy.LambdaInstanceFactory
extends Object
A factory that creates instances that represent lambda expressions.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected static class
Implements an explicit bridge method for a lambda expression.protected static enum
Implements a lambda class's executing transformer.protected static enum
An implementation of a instance factory for a lambda expression's class.protected static class
Implements a lambda expression's functional method.protected static class
Implements thewriteReplace
method for serializable lambda expressions. -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final ByteBuddy
The Byte Buddy instance to use for creating lambda objects.private static final String
A prefix for a field that represents a property of a lambda expression.private static final String
The name of a factory for a lambda expression.private static final AtomicInteger
A counter for naming lambda expressions randomly.private static final String
The infix to use for naming classes that represent lambda expression.private static final Class<?>
A type-safe constant to express that a class is not already loaded when applying a class file transformer. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
LambdaInstanceFactory
(ByteBuddy byteBuddy) Creates a new lambda instance factory. -
Method Summary
Modifier and TypeMethodDescriptionbyte[]
make
(Object targetTypeLookup, String lambdaMethodName, Object factoryMethodType, Object lambdaMethodType, Object targetMethodHandle, Object specializedLambdaMethodType, boolean serializable, List<Class<?>> markerInterfaces, List<?> additionalBridges, Collection<? extends ClassFileTransformer> classFileTransformers) Applies this lambda meta factory.
-
Field Details
-
LAMBDA_FACTORY
The name of a factory for a lambda expression.- See Also:
-
FIELD_PREFIX
A prefix for a field that represents a property of a lambda expression.- See Also:
-
LAMBDA_TYPE_INFIX
The infix to use for naming classes that represent lambda expression. The additional prefix is necessary because the subsequent counter is not sufficient to keep names unique compared to the original factory.- See Also:
-
NOT_PREVIOUSLY_DEFINED
A type-safe constant to express that a class is not already loaded when applying a class file transformer. -
LAMBDA_NAME_COUNTER
A counter for naming lambda expressions randomly. -
byteBuddy
The Byte Buddy instance to use for creating lambda objects.
-
-
Constructor Details
-
LambdaInstanceFactory
Creates a new lambda instance factory.- Parameters:
byteBuddy
- The Byte Buddy instance to use for creating lambda objects.
-
-
Method Details
-
make
public byte[] make(Object targetTypeLookup, String lambdaMethodName, Object factoryMethodType, Object lambdaMethodType, Object targetMethodHandle, Object specializedLambdaMethodType, boolean serializable, List<Class<?>> markerInterfaces, List<?> additionalBridges, Collection<? extends ClassFileTransformer> classFileTransformers) Applies this lambda meta factory.- Parameters:
targetTypeLookup
- A lookup context representing the creating class of this lambda expression.lambdaMethodName
- The name of the lambda expression's represented method.factoryMethodType
- The type of the lambda expression's represented method.lambdaMethodType
- The type of the lambda expression's factory method.targetMethodHandle
- A handle representing the target of the lambda expression's method.specializedLambdaMethodType
- A specialization of the type of the lambda expression's represented method.serializable
-true
if the lambda expression should be serializable.markerInterfaces
- A list of interfaces for the lambda expression to represent.additionalBridges
- A list of additional bridge methods to be implemented by the lambda expression.classFileTransformers
- A collection of class file transformers to apply when creating the class.- Returns:
- A binary representation of the transformed class file.
-