Package net.bytebuddy.asm
Class MemberSubstitution.Replacement.ForElementMatchers
- java.lang.Object
-
- net.bytebuddy.asm.MemberSubstitution.Replacement.ForElementMatchers
-
- All Implemented Interfaces:
MemberSubstitution.Replacement
- Enclosing interface:
- MemberSubstitution.Replacement
@Enhance public static class MemberSubstitution.Replacement.ForElementMatchers extends java.lang.Object implements MemberSubstitution.Replacement
A replacement that substitutes a member based on a row of element matchers.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static classMemberSubstitution.Replacement.ForElementMatchers.FactoryA factory for creating a replacement that chooses members based on a row of element matchers.-
Nested classes/interfaces inherited from interface net.bytebuddy.asm.MemberSubstitution.Replacement
MemberSubstitution.Replacement.Binding, MemberSubstitution.Replacement.ForElementMatchers, MemberSubstitution.Replacement.ForFirstBinding, MemberSubstitution.Replacement.InvocationType, MemberSubstitution.Replacement.NoOp
-
-
Field Summary
Fields Modifier and Type Field Description private ElementMatcher<? super FieldDescription.InDefinedShape>fieldMatcherThe field matcher to consider when discovering fields.private booleanincludeSuperCallstrueif super method calls should be matched.private booleanincludeVirtualCallstrueif virtual method calls should be matched.private booleanmatchFieldReadtrueif field reading access should be matched.private booleanmatchFieldWritetrueif field writing access should be matched.private ElementMatcher<? super MethodDescription>methodMatcherThe method matcher to consider when discovering methods.private MemberSubstitution.SubstitutionsubstitutionThe substitution to trigger if a member is matched.
-
Constructor Summary
Constructors Modifier Constructor Description protectedForElementMatchers(ElementMatcher<? super FieldDescription.InDefinedShape> fieldMatcher, ElementMatcher<? super MethodDescription> methodMatcher, boolean matchFieldRead, boolean matchFieldWrite, boolean includeVirtualCalls, boolean includeSuperCalls, MemberSubstitution.Substitution substitution)Creates a new replacement that triggers a substitution based on a row of matchers.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description MemberSubstitution.Replacement.Bindingbind(TypeDescription instrumentedType, MethodDescription instrumentedMethod, FieldDescription.InDefinedShape fieldDescription, boolean writeAccess)Binds this replacement for a field that was discovered.MemberSubstitution.Replacement.Bindingbind(TypeDescription instrumentedType, MethodDescription instrumentedMethod, TypeDescription typeDescription, MethodDescription methodDescription, MemberSubstitution.Replacement.InvocationType invocationType)Binds this replacement for a field that was discovered.
-
-
-
Field Detail
-
fieldMatcher
private final ElementMatcher<? super FieldDescription.InDefinedShape> fieldMatcher
The field matcher to consider when discovering fields.
-
methodMatcher
private final ElementMatcher<? super MethodDescription> methodMatcher
The method matcher to consider when discovering methods.
-
matchFieldRead
private final boolean matchFieldRead
trueif field reading access should be matched.
-
matchFieldWrite
private final boolean matchFieldWrite
trueif field writing access should be matched.
-
includeVirtualCalls
private final boolean includeVirtualCalls
trueif virtual method calls should be matched.
-
includeSuperCalls
private final boolean includeSuperCalls
trueif super method calls should be matched.
-
substitution
private final MemberSubstitution.Substitution substitution
The substitution to trigger if a member is matched.
-
-
Constructor Detail
-
ForElementMatchers
protected ForElementMatchers(ElementMatcher<? super FieldDescription.InDefinedShape> fieldMatcher, ElementMatcher<? super MethodDescription> methodMatcher, boolean matchFieldRead, boolean matchFieldWrite, boolean includeVirtualCalls, boolean includeSuperCalls, MemberSubstitution.Substitution substitution)
Creates a new replacement that triggers a substitution based on a row of matchers.- Parameters:
fieldMatcher- The field matcher to consider when discovering fields.methodMatcher- The method matcher to consider when discovering methods.matchFieldRead-trueif field reading access should be matched.matchFieldWrite-trueif field writing access should be matched.includeVirtualCalls-trueif virtual method calls should be matched.includeSuperCalls-trueif super method calls should be matched.substitution- The substitution to trigger if a member is matched.
-
-
Method Detail
-
bind
public MemberSubstitution.Replacement.Binding bind(TypeDescription instrumentedType, MethodDescription instrumentedMethod, FieldDescription.InDefinedShape fieldDescription, boolean writeAccess)
Binds this replacement for a field that was discovered.- Specified by:
bindin interfaceMemberSubstitution.Replacement- Parameters:
instrumentedType- The instrumented type.instrumentedMethod- The instrumented method.fieldDescription- The field that was discovered.writeAccess-trueif this field was written to.- Returns:
- A binding for the discovered field access.
-
bind
public MemberSubstitution.Replacement.Binding bind(TypeDescription instrumentedType, MethodDescription instrumentedMethod, TypeDescription typeDescription, MethodDescription methodDescription, MemberSubstitution.Replacement.InvocationType invocationType)
Binds this replacement for a field that was discovered.- Specified by:
bindin interfaceMemberSubstitution.Replacement- Parameters:
instrumentedType- The instrumented type.instrumentedMethod- The instrumented method.typeDescription- The type on which the method was invoked.methodDescription- The method that was discovered.invocationType- The invocation type for this method.- Returns:
- A binding for the discovered method invocation.
-
-