Package net.bytebuddy.asm
Class MemberSubstitution.Substitution.ForValue
- java.lang.Object
-
- net.bytebuddy.asm.MemberSubstitution.Substitution.ForValue
-
- All Implemented Interfaces:
MemberSubstitution.Substitution<MemberSubstitution.Target>,MemberSubstitution.Substitution.Factory<MemberSubstitution.Target>
- Enclosing interface:
- MemberSubstitution.Substitution<T extends MemberSubstitution.Target>
@Enhance public static class MemberSubstitution.Substitution.ForValue extends java.lang.Object implements MemberSubstitution.Substitution<MemberSubstitution.Target>, MemberSubstitution.Substitution.Factory<MemberSubstitution.Target>
A substitution that loads a fixed value.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface net.bytebuddy.asm.MemberSubstitution.Substitution
MemberSubstitution.Substitution.Chain<S extends MemberSubstitution.Target>, MemberSubstitution.Substitution.Factory<S extends MemberSubstitution.Target>, MemberSubstitution.Substitution.ForFieldAccess, MemberSubstitution.Substitution.ForMethodInvocation, MemberSubstitution.Substitution.ForValue, MemberSubstitution.Substitution.Stubbing
-
-
Field Summary
Fields Modifier and Type Field Description private StackManipulationstackManipulationThe stack manipulation to load the value that represents the substitution.private TypeDescription.GenerictypeDescriptionThe type of the represented stack manipulation.
-
Constructor Summary
Constructors Constructor Description ForValue(StackManipulation stackManipulation, TypeDescription.Generic typeDescription)Creates a new substitution for loading a constant value.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description MemberSubstitution.Substitution<MemberSubstitution.Target>make(TypeDescription instrumentedType, MethodDescription instrumentedMethod, TypePool typePool)Creates a substitution for an instrumented method.StackManipulationresolve(MemberSubstitution.Target target, TypeList.Generic parameters, TypeDescription.Generic result, JavaConstant.MethodHandle methodHandle, StackManipulation stackManipulation, int freeOffset)Resolves this substitution into a stack manipulation.
-
-
-
Field Detail
-
stackManipulation
private final StackManipulation stackManipulation
The stack manipulation to load the value that represents the substitution.
-
typeDescription
private final TypeDescription.Generic typeDescription
The type of the represented stack manipulation.
-
-
Constructor Detail
-
ForValue
public ForValue(StackManipulation stackManipulation, TypeDescription.Generic typeDescription)
Creates a new substitution for loading a constant value.- Parameters:
stackManipulation- The stack manipulation to load the value that represents the substitution.typeDescription- The type of the represented stack manipulation.
-
-
Method Detail
-
make
public MemberSubstitution.Substitution<MemberSubstitution.Target> make(TypeDescription instrumentedType, MethodDescription instrumentedMethod, TypePool typePool)
Creates a substitution for an instrumented method.- Specified by:
makein interfaceMemberSubstitution.Substitution.Factory<MemberSubstitution.Target>- Parameters:
instrumentedType- The instrumented type.instrumentedMethod- The instrumented method.typePool- The type pool being used.- Returns:
- The substitution to apply within the instrumented method.
-
resolve
public StackManipulation resolve(MemberSubstitution.Target target, TypeList.Generic parameters, TypeDescription.Generic result, JavaConstant.MethodHandle methodHandle, StackManipulation stackManipulation, int freeOffset)
Resolves this substitution into a stack manipulation.- Specified by:
resolvein interfaceMemberSubstitution.Substitution<MemberSubstitution.Target>- Parameters:
target- The targeted member that is substituted.parameters- All parameters that serve as input to this access.result- The result that is expected from the interaction orvoidif no result is expected.methodHandle- A method handle describing the substituted expression.stackManipulation- The original byte code expression that is being executed.freeOffset- The first free offset of the local variable array that can be used for storing values.- Returns:
- A stack manipulation that represents the access.
-
-