Top Description Inners Fields Constructors Methods
net.bytebuddy.asm

public Class ModifierAdjustment

extends AbstractBase
Class Inheritance
Annotations
@Enhance
Imports
net.bytebuddy.build.HashCodeAndEqualsPlugin, net.bytebuddy.description.field.FieldDescription, .FieldList, net.bytebuddy.description.method.MethodDescription, .MethodList, net.bytebuddy.description.modifier.ModifierContributor, net.bytebuddy.description.type.TypeDescription, net.bytebuddy.implementation.Implementation, net.bytebuddy.matcher.ElementMatcher, net.bytebuddy.pool.TypePool, net.bytebuddy.utility.CompoundList, .OpenedClassReader, net.bytebuddy.utility.nullability.MaybeNull, net.bytebuddy.jar.asm.ClassVisitor, .FieldVisitor, .MethodVisitor, java.util.*

A visitor wrapper that adjusts the modifiers of the instrumented type or its members.

Important Note

The removal of the method is not reflected in the created net.bytebuddy.dynamic.DynamicType's type description of the instrumented type. The modifier changes are neither visible to element matchers during an instrumentation.

See Also
net.bytebuddy.dynamic.Transformer.ForField#withModifiers(ModifierContributor.ForField...), net.bytebuddy.dynamic.Transformer.ForMethod#withModifiers(ModifierContributor.ForMethod...)

Nested and Inner Type Summary

Modifier and TypeClass and Description
protected static class
ModifierAdjustment.Adjustment<
The type of the adjusted element's description.
T
>

A description of a conditional adjustment.

protected static class
ModifierAdjustment.ModifierAdjustingClassVisitor

A class visitor that enforces a collection of modifier adjustments.

Field Summary

Modifier and TypeField and Description
private final List<ModifierAdjustment.Adjustment<FieldDescription.InDefinedShape>>
fieldAdjustments

A list of adjustments to apply to the instrumented type's declared fields.

private final List<ModifierAdjustment.Adjustment<MethodDescription>>
methodAdjustments

A list of adjustments to apply to the instrumented type's methods.

private final List<ModifierAdjustment.Adjustment<TypeDescription>>
typeAdjustments

A list of adjustments to apply to the instrumented type.

Constructor Summary

AccessConstructor and Description
public
ModifierAdjustment()

Creates a new modifier adjustment that does not adjust any modifiers.

protected
ModifierAdjustment(List<ModifierAdjustment.Adjustment<TypeDescription>>
A list of adjustments to apply to the instrumented type.
typeAdjustments
,
List<ModifierAdjustment.Adjustment<FieldDescription.InDefinedShape>>
A list of adjustments to apply to the instrumented type's declared fields.
fieldAdjustments
,
List<ModifierAdjustment.Adjustment<MethodDescription>>
A list of adjustments to apply to the instrumented type's methods.
methodAdjustments
)

Creates a new modifier adjustment.

Method Summary

Modifier and TypeMethod and Description
public ModifierAdjustment

Returns:

A new modifier adjustment that enforces the given modifier contributors and any previous adjustments.
withConstructorModifiers
(ModifierContributor.ForMethod...
The modifier contributors to enforce.
modifierContributor
)

Adjusts any constructor's modifiers.

public ModifierAdjustment

Returns:

A new modifier adjustment that enforces the given modifier contributors and any previous adjustments.
withConstructorModifiers
(List<? extends ModifierContributor.ForMethod>
The modifier contributors to enforce.
modifierContributors
)

Adjusts any constructor's modifiers.

public ModifierAdjustment

Returns:

A new modifier adjustment that enforces the given modifier contributors and any previous adjustments.
withConstructorModifiers
(ElementMatcher<? super MethodDescription>
The matcher that determines if a constructor's modifiers should be adjusted.
matcher
,
ModifierContributor.ForMethod...
The modifier contributors to enforce.
modifierContributor
)

Adjusts a constructor's modifiers if it fulfills the supplied matcher.

public ModifierAdjustment

Returns:

A new modifier adjustment that enforces the given modifier contributors and any previous adjustments.
withConstructorModifiers
(ElementMatcher<? super MethodDescription>
The matcher that determines if a constructor's modifiers should be adjusted.
matcher
,
List<? extends ModifierContributor.ForMethod>
The modifier contributors to enforce.
modifierContributors
)

Adjusts a constructor's modifiers if it fulfills the supplied matcher.

public ModifierAdjustment

Returns:

A new modifier adjustment that enforces the given modifier contributors and any previous adjustments.
withFieldModifiers
(ModifierContributor.ForField...
The modifier contributors to enforce.
modifierContributor
)

Adjusts any field's modifiers.

public ModifierAdjustment

Returns:

A new modifier adjustment that enforces the given modifier contributors and any previous adjustments.
withFieldModifiers
(List<? extends ModifierContributor.ForField>
The modifier contributors to enforce.
modifierContributors
)

Adjusts any field's modifiers.

public ModifierAdjustment

Returns:

A new modifier adjustment that enforces the given modifier contributors and any previous adjustments.
withFieldModifiers
(ElementMatcher<? super FieldDescription.InDefinedShape>
The matcher that determines if a field's modifiers should be adjusted.
matcher
,
ModifierContributor.ForField...
The modifier contributors to enforce.
modifierContributor
)

Adjusts a field's modifiers if it fulfills the supplied matcher.

public ModifierAdjustment

Returns:

A new modifier adjustment that enforces the given modifier contributors and any previous adjustments.
withFieldModifiers
(ElementMatcher<? super FieldDescription.InDefinedShape>
The matcher that determines if a field's modifiers should be adjusted.
matcher
,
List<? extends ModifierContributor.ForField>
The modifier contributors to enforce.
modifierContributors
)

Adjusts a field's modifiers if it fulfills the supplied matcher.

public ModifierAdjustment

Returns:

A new modifier adjustment that enforces the given modifier contributors and any previous adjustments.
withInvokableModifiers
(ModifierContributor.ForMethod...
The modifier contributors to enforce.
modifierContributor
)

Adjusts any method's or constructor's modifiers.

public ModifierAdjustment

Returns:

A new modifier adjustment that enforces the given modifier contributors and any previous adjustments.
withInvokableModifiers
(List<? extends ModifierContributor.ForMethod>
The modifier contributors to enforce.
modifierContributors
)

Adjusts any method's or constructor's modifiers.

public ModifierAdjustment

Returns:

A new modifier adjustment that enforces the given modifier contributors and any previous adjustments.
withInvokableModifiers
(ElementMatcher<? super MethodDescription>
The matcher that determines if a method's or constructor's modifiers should be adjusted.
matcher
,
ModifierContributor.ForMethod...
The modifier contributors to enforce.
modifierContributor
)

Adjusts a method's or constructor's modifiers if it fulfills the supplied matcher.

public ModifierAdjustment

Returns:

A new modifier adjustment that enforces the given modifier contributors and any previous adjustments.
withInvokableModifiers
(ElementMatcher<? super MethodDescription>
The matcher that determines if a method's or constructor's modifiers should be adjusted.
matcher
,
List<? extends ModifierContributor.ForMethod>
The modifier contributors to enforce.
modifierContributors
)

Adjusts a method's or constructor's modifiers if it fulfills the supplied matcher.

public ModifierAdjustment

Returns:

A new modifier adjustment that enforces the given modifier contributors and any previous adjustments.
withMethodModifiers
(ModifierContributor.ForMethod...
The modifier contributors to enforce.
modifierContributor
)

Adjusts any method's modifiers.

public ModifierAdjustment

Returns:

A new modifier adjustment that enforces the given modifier contributors and any previous adjustments.
withMethodModifiers
(List<? extends ModifierContributor.ForMethod>
The modifier contributors to enforce.
modifierContributors
)

Adjusts any method's modifiers.

public ModifierAdjustment

Returns:

A new modifier adjustment that enforces the given modifier contributors and any previous adjustments.
withMethodModifiers
(ElementMatcher<? super MethodDescription>
The matcher that determines if a method's modifiers should be adjusted.
matcher
,
ModifierContributor.ForMethod...
The modifier contributors to enforce.
modifierContributor
)

Adjusts a method's modifiers if it fulfills the supplied matcher.

public ModifierAdjustment

Returns:

A new modifier adjustment that enforces the given modifier contributors and any previous adjustments.
withMethodModifiers
(ElementMatcher<? super MethodDescription>
The matcher that determines if a method's modifiers should be adjusted.
matcher
,
List<? extends ModifierContributor.ForMethod>
The modifier contributors to enforce.
modifierContributors
)

Adjusts a method's modifiers if it fulfills the supplied matcher.

public ModifierAdjustment

Returns:

A new modifier adjustment that enforces the given modifier contributors and any previous adjustments.
withTypeModifiers
(ModifierContributor.ForType...
The modifier contributors to enforce.
modifierContributor
)

Adjusts any instrumented type's modifiers.

public ModifierAdjustment

Returns:

A new modifier adjustment that enforces the given modifier contributors and any previous adjustments.
withTypeModifiers
(List<? extends ModifierContributor.ForType>
The modifier contributors to enforce.
modifierContributors
)

Adjusts any instrumented type's modifiers.

public ModifierAdjustment

Returns:

A new modifier adjustment that enforces the given modifier contributors and any previous adjustments.
withTypeModifiers
(ElementMatcher<? super TypeDescription>
The matcher that determines a type's eligibility.
matcher
,
ModifierContributor.ForType...
The modifier contributors to enforce.
modifierContributor
)

Adjusts an instrumented type's modifiers if it matches the supplied matcher.

public ModifierAdjustment

Returns:

A new modifier adjustment that enforces the given modifier contributors and any previous adjustments.
withTypeModifiers
(ElementMatcher<? super TypeDescription>
The matcher that determines a type's eligibility.
matcher
,
List<? extends ModifierContributor.ForType>
The modifier contributors to enforce.
modifierContributors
)

Adjusts an instrumented type's modifiers if it matches the supplied matcher.

public ModifierAdjustment.ModifierAdjustingClassVisitor
wrap(TypeDescription
The instrumented type.
instrumentedType
,
ClassVisitor
A ClassVisitor to become the new primary class visitor to which the created net.bytebuddy.dynamic.DynamicType is written to.
classVisitor
,
Implementation.Context
The implementation context of the current instrumentation.
implementationContext
,
TypePool
The type pool that was provided for the class creation.
typePool
,
FieldList<FieldDescription.InDefinedShape>
The instrumented type's fields.
fields
,
MethodList<?>
The instrumented type's methods non-ignored declared and virtually inherited methods.
methods
,
int
The ASM net.bytebuddy.jar.asm.ClassWriter flags to consider.
writerFlags
,
int
The ASM net.bytebuddy.jar.asm.ClassReader flags to consider.
readerFlags
)

Implements net.bytebuddy.asm.AsmVisitorWrapper.wrap.

Applies a ClassVisitorWrapper to the creation of a net.bytebuddy.dynamic.DynamicType.
Inherited from net.bytebuddy.asm.AsmVisitorWrapper.AbstractBase:
mergeReadermergeWriter