Package net.bytebuddy.asm
Class MemberSubstitution.WithoutSpecification.ForMatchedMethod
- java.lang.Object
-
- net.bytebuddy.asm.MemberSubstitution.WithoutSpecification
-
- net.bytebuddy.asm.MemberSubstitution.WithoutSpecification.ForMatchedMethod
-
- Enclosing class:
- MemberSubstitution.WithoutSpecification
public static class MemberSubstitution.WithoutSpecification.ForMatchedMethod extends MemberSubstitution.WithoutSpecification
Describes a member substitution that requires a specification for how to replace a method or constructor.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class net.bytebuddy.asm.MemberSubstitution.WithoutSpecification
MemberSubstitution.WithoutSpecification.ForMatchedByteCodeElement, MemberSubstitution.WithoutSpecification.ForMatchedField, MemberSubstitution.WithoutSpecification.ForMatchedMethod
-
-
Field Summary
-
Fields inherited from class net.bytebuddy.asm.MemberSubstitution.WithoutSpecification
methodGraphCompiler, strict, substitution, typePoolResolver
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedForMatchedMethod(MethodGraph.Compiler methodGraphCompiler, MemberSubstitution.TypePoolResolver typePoolResolver, boolean strict, MemberSubstitution.Substitution substitution, ElementMatcher<? super MethodDescription> matcher)Creates a new member substitution for a matched method that requires a specification for how to perform a substitution.protectedForMatchedMethod(MethodGraph.Compiler methodGraphCompiler, MemberSubstitution.TypePoolResolver typePoolResolver, boolean strict, MemberSubstitution.Substitution substitution, ElementMatcher<? super MethodDescription> matcher, boolean includeVirtualCalls, boolean includeSuperCalls)Creates a new member substitution for a matched method that requires a specification for how to perform a substitution.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected MemberSubstitution.SubstitutiondoReplaceWith(FieldDescription fieldDescription)Creates a substitution for replacing the byte code elements matched by this instance with an access of the specified field.protected MemberSubstitution.SubstitutiondoReplaceWith(MethodDescription methodDescription)Creates a substitution for replacing the byte code elements matched by this instance with an invocation of the specified method.protected MemberSubstitution.SubstitutiondoStub()Applies the stubbing for this instance.MemberSubstitution.WithoutSpecificationonSuperCall()Limits the substituted method calls to method calls that invoke a method as asupercall.MemberSubstitution.WithoutSpecificationonVirtualCall()Limits the substituted method calls to method calls that invoke a method virtually (as opposed to asuperinvocation).-
Methods inherited from class net.bytebuddy.asm.MemberSubstitution.WithoutSpecification
replaceWith, replaceWith, replaceWith, replaceWith, stub
-
-
-
-
Constructor Detail
-
ForMatchedMethod
protected ForMatchedMethod(MethodGraph.Compiler methodGraphCompiler, MemberSubstitution.TypePoolResolver typePoolResolver, boolean strict, MemberSubstitution.Substitution substitution, ElementMatcher<? super MethodDescription> matcher)
Creates a new member substitution for a matched method that requires a specification for how to perform a substitution.- Parameters:
methodGraphCompiler- The method graph compiler to use.typePoolResolver- The type pool resolver to use.strict-trueif the method processing should be strict where an exception is raised if a member cannot be found.substitution- The substitution to apply.matcher- A matcher for any method or constructor that should be substituted.
-
ForMatchedMethod
protected ForMatchedMethod(MethodGraph.Compiler methodGraphCompiler, MemberSubstitution.TypePoolResolver typePoolResolver, boolean strict, MemberSubstitution.Substitution substitution, ElementMatcher<? super MethodDescription> matcher, boolean includeVirtualCalls, boolean includeSuperCalls)
Creates a new member substitution for a matched method that requires a specification for how to perform a substitution.- Parameters:
methodGraphCompiler- The method graph compiler to use.typePoolResolver- The type pool resolver to use.strict-trueif the method processing should be strict where an exception is raised if a member cannot be found.substitution- The substitution to apply.matcher- A matcher for any method or constructor that should be substituted.includeVirtualCalls-trueif this specification includes virtual invocations.includeSuperCalls-trueif this specification includessuperinvocations.
-
-
Method Detail
-
onVirtualCall
public MemberSubstitution.WithoutSpecification onVirtualCall()
Limits the substituted method calls to method calls that invoke a method virtually (as opposed to asuperinvocation).- Returns:
- This specification where only virtual methods are matched if they are not invoked as a virtual call.
-
onSuperCall
public MemberSubstitution.WithoutSpecification onSuperCall()
Limits the substituted method calls to method calls that invoke a method as asupercall.- Returns:
- This specification where only virtual methods are matched if they are not invoked as a super call.
-
doStub
protected MemberSubstitution.Substitution doStub()
Description copied from class:MemberSubstitution.WithoutSpecificationApplies the stubbing for this instance.- Specified by:
doStubin classMemberSubstitution.WithoutSpecification- Returns:
- A suitable substitution.
-
doReplaceWith
protected MemberSubstitution.Substitution doReplaceWith(FieldDescription fieldDescription)
Description copied from class:MemberSubstitution.WithoutSpecificationCreates a substitution for replacing the byte code elements matched by this instance with an access of the specified field.- Specified by:
doReplaceWithin classMemberSubstitution.WithoutSpecification- Parameters:
fieldDescription- The field to access.- Returns:
- A suitable substitution.
-
doReplaceWith
protected MemberSubstitution.Substitution doReplaceWith(MethodDescription methodDescription)
Description copied from class:MemberSubstitution.WithoutSpecificationCreates a substitution for replacing the byte code elements matched by this instance with an invocation of the specified method.- Specified by:
doReplaceWithin classMemberSubstitution.WithoutSpecification- Parameters:
methodDescription- The method to invoke.- Returns:
- A suitable substitution.
-
-