Class AnnotationRemoval
java.lang.Object
net.bytebuddy.asm.AsmVisitorWrapper.AbstractBase
net.bytebuddy.asm.AnnotationRemoval
- All Implemented Interfaces:
AsmVisitorWrapper
A visitor wrapper that removes annotations from the instrumented type.
-
Nested Class Summary
Nested classes/interfaces inherited from interface AsmVisitorWrapper
AsmVisitorWrapper.AbstractBase, AsmVisitorWrapper.Compound, AsmVisitorWrapper.ForDeclaredFields, AsmVisitorWrapper.ForDeclaredMethods, AsmVisitorWrapper.NoOp -
Field Summary
Fields inherited from interface AsmVisitorWrapper
NO_FLAGS -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedAnnotationRemoval(boolean type, ElementMatcher<? super FieldDescription.InDefinedShape> fieldMatcher, ElementMatcher<? super MethodDescription> methodMatcher, ElementMatcher<? super AnnotationDescription> annotationMatcher, int parameters) Creates a visitor for annotation removal. -
Method Summary
Modifier and TypeMethodDescriptiononConstructorParameter(ElementMatcher<? super MethodDescription> matcher, int parameter) Creates a visitor that removes annotations from the constructor parameters with the given index where the constructor matches the specified matcher.onConstructorParameters(ElementMatcher<? super MethodDescription> matcher) Creates a visitor that removes annotations from constructor parameters where the constructor matches the specified matcher.onConstructors(ElementMatcher<? super MethodDescription> matcher) Creates a visitor that removes annotations from constructors that match the specified matcher.onConstructorsAndParameters(ElementMatcher<? super MethodDescription> matcher) Creates a visitor that removes annotations from constructors and their parameters that match the specified matcher.onFields(ElementMatcher<? super FieldDescription> matcher) Creates a visitor that only removes annotations from fields that match the specified matcher.onInvokableParameter(ElementMatcher<? super MethodDescription> matcher, int parameter) Creates a visitor that removes annotations from the constructor or method parameters with the given index where the constructor or method matches the specified matcher.onInvokableParameters(ElementMatcher<? super MethodDescription> matcher) Creates a visitor that removes annotations from constructor or method parameters where the constructor or method matches the specified matcher.onInvokables(ElementMatcher<? super MethodDescription> matcher) Creates a visitor that removes annotations from constructors or methods that match the specified matcher.onInvokablesAndParameters(ElementMatcher<? super MethodDescription> matcher) Creates a visitor that removes annotations from constructors or methods and their parameters that match the specified matcher.onMethodParameter(ElementMatcher<? super MethodDescription> matcher, int parameter) Creates a visitor that removes annotations from the method parameters with the given index where the method matches the specified matcher.onMethodParameters(ElementMatcher<? super MethodDescription> matcher) Creates a visitor that removes annotations from method parameters where the method matches the specified matcher.onMethods(ElementMatcher<? super MethodDescription> matcher) Creates a visitor that removes annotations from methods that match the specified matcher.onMethodsAndParameters(ElementMatcher<? super MethodDescription> matcher) Creates a visitor that removes annotations from methods and their parameters that match the specified matcher.onType()Creates a visitor that only removes annotations from the type.static AnnotationRemovalstrip(ElementMatcher<? super AnnotationDescription> matcher) Creates a visitor that removes all annotations that match the specified matcher from the instrumented type.org.objectweb.asm.ClassVisitorwrap(TypeDescription instrumentedType, org.objectweb.asm.ClassVisitor classVisitor, Implementation.Context implementationContext, TypePool typePool, FieldList<FieldDescription.InDefinedShape> fields, MethodList<?> methods, int writerFlags, int readerFlags) Applies aClassVisitorWrapperto the creation of aDynamicType.Methods inherited from class AsmVisitorWrapper.AbstractBase
mergeReader, mergeWriter
-
Constructor Details
-
AnnotationRemoval
protected AnnotationRemoval(boolean type, ElementMatcher<? super FieldDescription.InDefinedShape> fieldMatcher, ElementMatcher<? super MethodDescription> methodMatcher, ElementMatcher<? super AnnotationDescription> annotationMatcher, int parameters) Creates a visitor for annotation removal.- Parameters:
type-trueif annotations on the type should be removed.fieldMatcher- Matches fields from which annotations should be removed.methodMatcher- Matches methods from which annotations should be removed.annotationMatcher- Matches annotations that should be removed.parameters- Indices the method parameter index from which annotations should be removed, or a negative value to indicate different treatment.
-
-
Method Details
-
strip
Creates a visitor that removes all annotations that match the specified matcher from the instrumented type.- Parameters:
matcher- The matcher to indicate what annotations to remove.- Returns:
- A visitor that removes the specified annotations.
-
onType
Creates a visitor that only removes annotations from the type.- Returns:
- An appropriate visitor for annotation removal.
-
onFields
Creates a visitor that only removes annotations from fields that match the specified matcher.- Parameters:
matcher- A matcher that indicates from what fields annotations should be removed.- Returns:
- An appropriate visitor for annotation removal.
-
onMethods
Creates a visitor that removes annotations from methods that match the specified matcher.- Parameters:
matcher- A matcher that indicates from what methods annotations should be removed.- Returns:
- An appropriate visitor for annotation removal.
-
onMethodsAndParameters
Creates a visitor that removes annotations from methods and their parameters that match the specified matcher.- Parameters:
matcher- A matcher that indicates from what methods annotations should be removed.- Returns:
- An appropriate visitor for annotation removal.
-
onMethodParameters
Creates a visitor that removes annotations from method parameters where the method matches the specified matcher.- Parameters:
matcher- A matcher that indicates from what methods annotations should be removed.- Returns:
- An appropriate visitor for annotation removal.
-
onMethodParameter
public AsmVisitorWrapper onMethodParameter(ElementMatcher<? super MethodDescription> matcher, int parameter) Creates a visitor that removes annotations from the method parameters with the given index where the method matches the specified matcher.- Parameters:
matcher- A matcher that indicates from what methods annotations should be removed.parameter- The index of the parameter of which to remove annotations.- Returns:
- An appropriate visitor for annotation removal.
-
onConstructors
Creates a visitor that removes annotations from constructors that match the specified matcher.- Parameters:
matcher- A matcher that indicates from what constructors annotations should be removed.- Returns:
- An appropriate visitor for annotation removal.
-
onConstructorsAndParameters
public AsmVisitorWrapper onConstructorsAndParameters(ElementMatcher<? super MethodDescription> matcher) Creates a visitor that removes annotations from constructors and their parameters that match the specified matcher.- Parameters:
matcher- A matcher that indicates from what constructors annotations should be removed.- Returns:
- An appropriate visitor for annotation removal.
-
onConstructorParameters
Creates a visitor that removes annotations from constructor parameters where the constructor matches the specified matcher.- Parameters:
matcher- A matcher that indicates from what constructors annotations should be removed.- Returns:
- An appropriate visitor for annotation removal.
-
onConstructorParameter
public AsmVisitorWrapper onConstructorParameter(ElementMatcher<? super MethodDescription> matcher, int parameter) Creates a visitor that removes annotations from the constructor parameters with the given index where the constructor matches the specified matcher.- Parameters:
matcher- A matcher that indicates from what constructors annotations should be removed.parameter- The index of the parameter of which to remove annotations.- Returns:
- An appropriate visitor for annotation removal.
-
onInvokables
Creates a visitor that removes annotations from constructors or methods that match the specified matcher.- Parameters:
matcher- A matcher that indicates from what constructors or methods annotations should be removed.- Returns:
- An appropriate visitor for annotation removal.
-
onInvokablesAndParameters
public AsmVisitorWrapper onInvokablesAndParameters(ElementMatcher<? super MethodDescription> matcher) Creates a visitor that removes annotations from constructors or methods and their parameters that match the specified matcher.- Parameters:
matcher- A matcher that indicates from what constructors or methods annotations should be removed.- Returns:
- An appropriate visitor for annotation removal.
-
onInvokableParameters
Creates a visitor that removes annotations from constructor or method parameters where the constructor or method matches the specified matcher.- Parameters:
matcher- A matcher that indicates from what constructors or methods annotations should be removed.- Returns:
- An appropriate visitor for annotation removal.
-
onInvokableParameter
public AsmVisitorWrapper onInvokableParameter(ElementMatcher<? super MethodDescription> matcher, int parameter) Creates a visitor that removes annotations from the constructor or method parameters with the given index where the constructor or method matches the specified matcher.- Parameters:
matcher- A matcher that indicates from what constructors or methods annotations should be removed.parameter- The index of the parameter of which to remove annotations.- Returns:
- An appropriate visitor for annotation removal.
-
wrap
public org.objectweb.asm.ClassVisitor wrap(TypeDescription instrumentedType, org.objectweb.asm.ClassVisitor classVisitor, Implementation.Context implementationContext, TypePool typePool, FieldList<FieldDescription.InDefinedShape> fields, MethodList<?> methods, int writerFlags, int readerFlags) Applies aClassVisitorWrapperto the creation of aDynamicType.- Parameters:
instrumentedType- The instrumented type.classVisitor- AClassVisitorto become the new primary class visitor to which the createdDynamicTypeis written to.implementationContext- The implementation context of the current instrumentation.typePool- The type pool that was provided for the class creation.fields- The instrumented type's fields.methods- The instrumented type's methods non-ignored declared and virtually inherited methods.writerFlags- The ASMClassWriterflags to consider.readerFlags- The ASMClassReaderflags to consider.- Returns:
- A new
ClassVisitorthat usually delegates to theClassVisitordelivered in the argument.
-