Package net.bytebuddy.asm
Enum MemberSubstitution.Substitution.Stubbing
- java.lang.Object
-
- java.lang.Enum<MemberSubstitution.Substitution.Stubbing>
-
- net.bytebuddy.asm.MemberSubstitution.Substitution.Stubbing
-
- All Implemented Interfaces:
java.io.Serializable
,java.lang.Comparable<MemberSubstitution.Substitution.Stubbing>
,MemberSubstitution.Substitution
,MemberSubstitution.Substitution.Factory
- Enclosing interface:
- MemberSubstitution.Substitution
public static enum MemberSubstitution.Substitution.Stubbing extends java.lang.Enum<MemberSubstitution.Substitution.Stubbing> implements MemberSubstitution.Substitution, MemberSubstitution.Substitution.Factory
A substitution that drops any field or method access and returns the expected return type's default value, i.enull
or zero for primitive types.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface net.bytebuddy.asm.MemberSubstitution.Substitution
MemberSubstitution.Substitution.Chain, MemberSubstitution.Substitution.Factory, MemberSubstitution.Substitution.ForFieldAccess, MemberSubstitution.Substitution.ForMethodInvocation, MemberSubstitution.Substitution.Stubbing
-
-
Enum Constant Summary
Enum Constants Enum Constant Description INSTANCE
The singleton instance.
-
Constructor Summary
Constructors Modifier Constructor Description private
Stubbing()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description MemberSubstitution.Substitution
make(TypeDescription instrumentedType, MethodDescription instrumentedMethod, TypePool typePool)
Creates a substitution for an instrumented method.StackManipulation
resolve(TypeDescription targetType, ByteCodeElement target, TypeList.Generic parameters, TypeDescription.Generic result, int freeOffset)
Resolves this substitution into a stack manipulation.static MemberSubstitution.Substitution.Stubbing
valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name.static MemberSubstitution.Substitution.Stubbing[]
values()
Returns an array containing the constants of this enum type, in the order they are declared.
-
-
-
Enum Constant Detail
-
INSTANCE
public static final MemberSubstitution.Substitution.Stubbing INSTANCE
The singleton instance.
-
-
Method Detail
-
values
public static MemberSubstitution.Substitution.Stubbing[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:for (MemberSubstitution.Substitution.Stubbing c : MemberSubstitution.Substitution.Stubbing.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
public static MemberSubstitution.Substitution.Stubbing valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)- Parameters:
name
- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
java.lang.IllegalArgumentException
- if this enum type has no constant with the specified namejava.lang.NullPointerException
- if the argument is null
-
make
public MemberSubstitution.Substitution make(TypeDescription instrumentedType, MethodDescription instrumentedMethod, TypePool typePool)
Creates a substitution for an instrumented method.- Specified by:
make
in interfaceMemberSubstitution.Substitution.Factory
- 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(TypeDescription targetType, ByteCodeElement target, TypeList.Generic parameters, TypeDescription.Generic result, int freeOffset)
Resolves this substitution into a stack manipulation.- Specified by:
resolve
in interfaceMemberSubstitution.Substitution
- Parameters:
targetType
- The target type on which a member is accessed.target
- The target field, method or constructor that is substituted,parameters
- All parameters that serve as input to this access.result
- The result that is expected from the interaction orvoid
if no result is expected.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.
-
-