@HashCodeAndEqualsPlugin.Enhance public class ModifierAdjustment extends AsmVisitorWrapper.AbstractBase
A visitor wrapper that adjusts the modifiers of the instrumented type or its members.
Important: The removal of the method is not reflected in the created DynamicType
's
type description of the instrumented type. The modifier changes are neither visible to element matchers during an instrumentation.
Modifier and Type | Class and Description |
---|---|
protected static class |
ModifierAdjustment.Adjustment<T>
A description of a conditional adjustment.
|
protected static class |
ModifierAdjustment.ModifierAdjustingClassVisitor
A class visitor that enforces a collection of modifier adjustments.
|
AsmVisitorWrapper.AbstractBase, AsmVisitorWrapper.Compound, AsmVisitorWrapper.ForDeclaredFields, AsmVisitorWrapper.ForDeclaredMethods, AsmVisitorWrapper.NoOp
NO_FLAGS
Modifier | Constructor and Description |
---|---|
|
ModifierAdjustment()
Creates a new modifier adjustment that does not adjust any modifiers.
|
protected |
ModifierAdjustment(List<ModifierAdjustment.Adjustment<TypeDescription>> typeAdjustments,
List<ModifierAdjustment.Adjustment<FieldDescription.InDefinedShape>> fieldAdjustments,
List<ModifierAdjustment.Adjustment<MethodDescription>> methodAdjustments)
Creates a new modifier adjustment.
|
Modifier and Type | Method and Description |
---|---|
ModifierAdjustment |
withConstructorModifiers(ElementMatcher<? super MethodDescription> matcher,
List<? extends ModifierContributor.ForMethod> modifierContributors)
Adjusts a constructor's modifiers if it fulfills the supplied matcher.
|
ModifierAdjustment |
withConstructorModifiers(ElementMatcher<? super MethodDescription> matcher,
ModifierContributor.ForMethod... modifierContributor)
Adjusts a constructor's modifiers if it fulfills the supplied matcher.
|
ModifierAdjustment |
withConstructorModifiers(List<? extends ModifierContributor.ForMethod> modifierContributors)
Adjusts any constructor's modifiers.
|
ModifierAdjustment |
withConstructorModifiers(ModifierContributor.ForMethod... modifierContributor)
Adjusts any constructor's modifiers.
|
ModifierAdjustment |
withFieldModifiers(ElementMatcher<? super FieldDescription.InDefinedShape> matcher,
List<? extends ModifierContributor.ForField> modifierContributors)
Adjusts a field's modifiers if it fulfills the supplied matcher.
|
ModifierAdjustment |
withFieldModifiers(ElementMatcher<? super FieldDescription.InDefinedShape> matcher,
ModifierContributor.ForField... modifierContributor)
Adjusts a field's modifiers if it fulfills the supplied matcher.
|
ModifierAdjustment |
withFieldModifiers(List<? extends ModifierContributor.ForField> modifierContributors)
Adjusts any field's modifiers.
|
ModifierAdjustment |
withFieldModifiers(ModifierContributor.ForField... modifierContributor)
Adjusts any field's modifiers.
|
ModifierAdjustment |
withInvokableModifiers(ElementMatcher<? super MethodDescription> matcher,
List<? extends ModifierContributor.ForMethod> modifierContributors)
Adjusts a method's or constructor's modifiers if it fulfills the supplied matcher.
|
ModifierAdjustment |
withInvokableModifiers(ElementMatcher<? super MethodDescription> matcher,
ModifierContributor.ForMethod... modifierContributor)
Adjusts a method's or constructor's modifiers if it fulfills the supplied matcher.
|
ModifierAdjustment |
withInvokableModifiers(List<? extends ModifierContributor.ForMethod> modifierContributors)
Adjusts any method's or constructor's modifiers.
|
ModifierAdjustment |
withInvokableModifiers(ModifierContributor.ForMethod... modifierContributor)
Adjusts any method's or constructor's modifiers.
|
ModifierAdjustment |
withMethodModifiers(ElementMatcher<? super MethodDescription> matcher,
List<? extends ModifierContributor.ForMethod> modifierContributors)
Adjusts a method's modifiers if it fulfills the supplied matcher.
|
ModifierAdjustment |
withMethodModifiers(ElementMatcher<? super MethodDescription> matcher,
ModifierContributor.ForMethod... modifierContributor)
Adjusts a method's modifiers if it fulfills the supplied matcher.
|
ModifierAdjustment |
withMethodModifiers(List<? extends ModifierContributor.ForMethod> modifierContributors)
Adjusts any method's modifiers.
|
ModifierAdjustment |
withMethodModifiers(ModifierContributor.ForMethod... modifierContributor)
Adjusts any method's modifiers.
|
ModifierAdjustment |
withTypeModifiers(ElementMatcher<? super TypeDescription> matcher,
List<? extends ModifierContributor.ForType> modifierContributors)
Adjusts an instrumented type's modifiers if it matches the supplied matcher.
|
ModifierAdjustment |
withTypeModifiers(ElementMatcher<? super TypeDescription> matcher,
ModifierContributor.ForType... modifierContributor)
Adjusts an instrumented type's modifiers if it matches the supplied matcher.
|
ModifierAdjustment |
withTypeModifiers(List<? extends ModifierContributor.ForType> modifierContributors)
Adjusts any instrumented type's modifiers.
|
ModifierAdjustment |
withTypeModifiers(ModifierContributor.ForType... modifierContributor)
Adjusts any instrumented type's modifiers.
|
ModifierAdjustment.ModifierAdjustingClassVisitor |
wrap(TypeDescription instrumentedType,
org.objectweb.asm.ClassVisitor classVisitor,
Implementation.Context implementationContext,
TypePool typePool,
FieldList<FieldDescription.InDefinedShape> fields,
MethodList<?> methods,
int writerFlags,
int readerFlags)
Applies a
ClassVisitorWrapper to the creation of a DynamicType . |
mergeReader, mergeWriter
public ModifierAdjustment()
protected ModifierAdjustment(List<ModifierAdjustment.Adjustment<TypeDescription>> typeAdjustments, List<ModifierAdjustment.Adjustment<FieldDescription.InDefinedShape>> fieldAdjustments, List<ModifierAdjustment.Adjustment<MethodDescription>> methodAdjustments)
typeAdjustments
- A list of adjustments to apply to the instrumented type.fieldAdjustments
- A list of adjustments to apply to the instrumented type's declared fields.methodAdjustments
- A list of adjustments to apply to the instrumented type's methods.public ModifierAdjustment withTypeModifiers(ModifierContributor.ForType... modifierContributor)
modifierContributor
- The modifier contributors to enforce.public ModifierAdjustment withTypeModifiers(List<? extends ModifierContributor.ForType> modifierContributors)
modifierContributors
- The modifier contributors to enforce.public ModifierAdjustment withTypeModifiers(ElementMatcher<? super TypeDescription> matcher, ModifierContributor.ForType... modifierContributor)
matcher
- The matcher that determines a type's eligibility.modifierContributor
- The modifier contributors to enforce.public ModifierAdjustment withTypeModifiers(ElementMatcher<? super TypeDescription> matcher, List<? extends ModifierContributor.ForType> modifierContributors)
matcher
- The matcher that determines a type's eligibility.modifierContributors
- The modifier contributors to enforce.public ModifierAdjustment withFieldModifiers(ModifierContributor.ForField... modifierContributor)
modifierContributor
- The modifier contributors to enforce.public ModifierAdjustment withFieldModifiers(List<? extends ModifierContributor.ForField> modifierContributors)
modifierContributors
- The modifier contributors to enforce.public ModifierAdjustment withFieldModifiers(ElementMatcher<? super FieldDescription.InDefinedShape> matcher, ModifierContributor.ForField... modifierContributor)
matcher
- The matcher that determines if a field's modifiers should be adjusted.modifierContributor
- The modifier contributors to enforce.public ModifierAdjustment withFieldModifiers(ElementMatcher<? super FieldDescription.InDefinedShape> matcher, List<? extends ModifierContributor.ForField> modifierContributors)
matcher
- The matcher that determines if a field's modifiers should be adjusted.modifierContributors
- The modifier contributors to enforce.public ModifierAdjustment withMethodModifiers(ModifierContributor.ForMethod... modifierContributor)
modifierContributor
- The modifier contributors to enforce.public ModifierAdjustment withMethodModifiers(List<? extends ModifierContributor.ForMethod> modifierContributors)
modifierContributors
- The modifier contributors to enforce.public ModifierAdjustment withMethodModifiers(ElementMatcher<? super MethodDescription> matcher, ModifierContributor.ForMethod... modifierContributor)
matcher
- The matcher that determines if a method's modifiers should be adjusted.modifierContributor
- The modifier contributors to enforce.public ModifierAdjustment withMethodModifiers(ElementMatcher<? super MethodDescription> matcher, List<? extends ModifierContributor.ForMethod> modifierContributors)
matcher
- The matcher that determines if a method's modifiers should be adjusted.modifierContributors
- The modifier contributors to enforce.public ModifierAdjustment withConstructorModifiers(ModifierContributor.ForMethod... modifierContributor)
modifierContributor
- The modifier contributors to enforce.public ModifierAdjustment withConstructorModifiers(List<? extends ModifierContributor.ForMethod> modifierContributors)
modifierContributors
- The modifier contributors to enforce.public ModifierAdjustment withConstructorModifiers(ElementMatcher<? super MethodDescription> matcher, ModifierContributor.ForMethod... modifierContributor)
matcher
- The matcher that determines if a constructor's modifiers should be adjusted.modifierContributor
- The modifier contributors to enforce.public ModifierAdjustment withConstructorModifiers(ElementMatcher<? super MethodDescription> matcher, List<? extends ModifierContributor.ForMethod> modifierContributors)
matcher
- The matcher that determines if a constructor's modifiers should be adjusted.modifierContributors
- The modifier contributors to enforce.public ModifierAdjustment withInvokableModifiers(ModifierContributor.ForMethod... modifierContributor)
modifierContributor
- The modifier contributors to enforce.public ModifierAdjustment withInvokableModifiers(List<? extends ModifierContributor.ForMethod> modifierContributors)
modifierContributors
- The modifier contributors to enforce.public ModifierAdjustment withInvokableModifiers(ElementMatcher<? super MethodDescription> matcher, ModifierContributor.ForMethod... modifierContributor)
matcher
- The matcher that determines if a method's or constructor's modifiers should be adjusted.modifierContributor
- The modifier contributors to enforce.public ModifierAdjustment withInvokableModifiers(ElementMatcher<? super MethodDescription> matcher, List<? extends ModifierContributor.ForMethod> modifierContributors)
matcher
- The matcher that determines if a method's or constructor's modifiers should be adjusted.modifierContributors
- The modifier contributors to enforce.public ModifierAdjustment.ModifierAdjustingClassVisitor wrap(TypeDescription instrumentedType, org.objectweb.asm.ClassVisitor classVisitor, Implementation.Context implementationContext, TypePool typePool, FieldList<FieldDescription.InDefinedShape> fields, MethodList<?> methods, int writerFlags, int readerFlags)
ClassVisitorWrapper
to the creation of a DynamicType
.instrumentedType
- The instrumented type.classVisitor
- A ClassVisitor
to become the new primary class visitor to which the created
DynamicType
is 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 ASM ClassWriter
flags to consider.readerFlags
- The ASM ClassReader
flags to consider.ClassVisitor
that usually delegates to the ClassVisitor
delivered in the argument.Copyright © 2014–2019. All rights reserved.