Package net.bytebuddy.asm
Class Advice.OffsetMapping.ForStackManipulation.Factory<T extends Annotation>
java.lang.Object
net.bytebuddy.asm.Advice.OffsetMapping.ForStackManipulation.Factory<T>
- Type Parameters:
T
- The annotation type this factory binds.
- All Implemented Interfaces:
Advice.OffsetMapping.Factory<T>
- Enclosing class:
- Advice.OffsetMapping.ForStackManipulation
@Enhance
public static class Advice.OffsetMapping.ForStackManipulation.Factory<T extends Annotation>
extends Object
implements Advice.OffsetMapping.Factory<T>
A factory that binds a stack manipulation.
-
Nested Class Summary
Nested classes/interfaces inherited from interface net.bytebuddy.asm.Advice.OffsetMapping.Factory
Advice.OffsetMapping.Factory.AdviceType, Advice.OffsetMapping.Factory.Illegal<T extends Annotation>, Advice.OffsetMapping.Factory.Simple<T extends Annotation>
-
Field Summary
FieldsModifier and TypeFieldDescriptionThe annotation type.private final StackManipulation
The stack manipulation that loads the bound value.private final TypeDescription.Generic
The type of the loaded value. -
Constructor Summary
ConstructorsConstructorDescriptionFactory
(Class<T> annotationType, EnumerationDescription enumerationDescription) Creates a new factory for binding an enumeration.Factory
(Class<T> annotationType, TypeDescription typeDescription) Creates a new factory for binding a type description.Factory
(Class<T> annotationType, StackManipulation stackManipulation, TypeDescription.Generic typeDescription) Creates a new factory for binding a stack manipulation. -
Method Summary
Modifier and TypeMethodDescriptionReturns the annotation type of this factory.make
(ParameterDescription.InDefinedShape target, AnnotationDescription.Loadable<T> annotation, Advice.OffsetMapping.Factory.AdviceType adviceType) Creates a new offset mapping for the supplied parameter if possible.static <S extends Annotation>
Advice.OffsetMapping.Factory<S>Creates a binding for a fixedString
, a primitive value or a method handle or type.
-
Field Details
-
annotationType
The annotation type. -
stackManipulation
The stack manipulation that loads the bound value. -
typeDescription
The type of the loaded value.
-
-
Constructor Details
-
Factory
Creates a new factory for binding a type description.- Parameters:
annotationType
- The annotation type.typeDescription
- The type to bind.
-
Factory
Creates a new factory for binding an enumeration.- Parameters:
annotationType
- The annotation type.enumerationDescription
- The enumeration to bind.
-
Factory
public Factory(Class<T> annotationType, StackManipulation stackManipulation, TypeDescription.Generic typeDescription) Creates a new factory for binding a stack manipulation.- Parameters:
annotationType
- The annotation type.stackManipulation
- The stack manipulation that loads the bound value.typeDescription
- The type of the loaded value.
-
-
Method Details
-
of
public static <S extends Annotation> Advice.OffsetMapping.Factory<S> of(Class<S> annotationType, Object value) Creates a binding for a fixedString
, a primitive value or a method handle or type.- Type Parameters:
S
- The annotation type.- Parameters:
annotationType
- The annotation type.value
- The primitive (wrapper) value,String
value, method handle or type to bind.- Returns:
- A factory for creating an offset mapping that binds the supplied value.
-
getAnnotationType
Returns the annotation type of this factory.- Specified by:
getAnnotationType
in interfaceAdvice.OffsetMapping.Factory<T extends Annotation>
- Returns:
- The factory's annotation type.
-
make
public Advice.OffsetMapping make(ParameterDescription.InDefinedShape target, AnnotationDescription.Loadable<T> annotation, Advice.OffsetMapping.Factory.AdviceType adviceType) Creates a new offset mapping for the supplied parameter if possible.- Specified by:
make
in interfaceAdvice.OffsetMapping.Factory<T extends Annotation>
- Parameters:
target
- The parameter description for which to resolve an offset mapping.annotation
- The annotation that triggered this factory.adviceType
-true
if the binding is applied using advice method delegation.- Returns:
- A resolved offset mapping or
null
if no mapping can be resolved for this parameter.
-