Class ModifierAdjustment

    • Method Detail

      • withTypeModifiers

        public ModifierAdjustment withTypeModifiers​(ModifierContributor.ForType... modifierContributor)
        Adjusts any instrumented type's modifiers.
        Parameters:
        modifierContributor - The modifier contributors to enforce.
        Returns:
        A new modifier adjustment that enforces the given modifier contributors and any previous adjustments.
      • withTypeModifiers

        public ModifierAdjustment withTypeModifiers​(java.util.List<? extends ModifierContributor.ForType> modifierContributors)
        Adjusts any instrumented type's modifiers.
        Parameters:
        modifierContributors - The modifier contributors to enforce.
        Returns:
        A new modifier adjustment that enforces the given modifier contributors and any previous adjustments.
      • withTypeModifiers

        public ModifierAdjustment withTypeModifiers​(ElementMatcher<? super TypeDescription> matcher,
                                                    ModifierContributor.ForType... modifierContributor)
        Adjusts an instrumented type's modifiers if it matches the supplied matcher.
        Parameters:
        matcher - The matcher that determines a type's eligibility.
        modifierContributor - The modifier contributors to enforce.
        Returns:
        A new modifier adjustment that enforces the given modifier contributors and any previous adjustments.
      • withTypeModifiers

        public ModifierAdjustment withTypeModifiers​(ElementMatcher<? super TypeDescription> matcher,
                                                    java.util.List<? extends ModifierContributor.ForType> modifierContributors)
        Adjusts an instrumented type's modifiers if it matches the supplied matcher.
        Parameters:
        matcher - The matcher that determines a type's eligibility.
        modifierContributors - The modifier contributors to enforce.
        Returns:
        A new modifier adjustment that enforces the given modifier contributors and any previous adjustments.
      • withFieldModifiers

        public ModifierAdjustment withFieldModifiers​(ModifierContributor.ForField... modifierContributor)
        Adjusts any field's modifiers.
        Parameters:
        modifierContributor - The modifier contributors to enforce.
        Returns:
        A new modifier adjustment that enforces the given modifier contributors and any previous adjustments.
      • withFieldModifiers

        public ModifierAdjustment withFieldModifiers​(java.util.List<? extends ModifierContributor.ForField> modifierContributors)
        Adjusts any field's modifiers.
        Parameters:
        modifierContributors - The modifier contributors to enforce.
        Returns:
        A new modifier adjustment that enforces the given modifier contributors and any previous adjustments.
      • withFieldModifiers

        public ModifierAdjustment withFieldModifiers​(ElementMatcher<? super FieldDescription.InDefinedShape> matcher,
                                                     ModifierContributor.ForField... modifierContributor)
        Adjusts a field's modifiers if it fulfills the supplied matcher.
        Parameters:
        matcher - The matcher that determines if a field's modifiers should be adjusted.
        modifierContributor - The modifier contributors to enforce.
        Returns:
        A new modifier adjustment that enforces the given modifier contributors and any previous adjustments.
      • withFieldModifiers

        public ModifierAdjustment withFieldModifiers​(ElementMatcher<? super FieldDescription.InDefinedShape> matcher,
                                                     java.util.List<? extends ModifierContributor.ForField> modifierContributors)
        Adjusts a field's modifiers if it fulfills the supplied matcher.
        Parameters:
        matcher - The matcher that determines if a field's modifiers should be adjusted.
        modifierContributors - The modifier contributors to enforce.
        Returns:
        A new modifier adjustment that enforces the given modifier contributors and any previous adjustments.
      • withMethodModifiers

        public ModifierAdjustment withMethodModifiers​(ModifierContributor.ForMethod... modifierContributor)
        Adjusts any method's modifiers.
        Parameters:
        modifierContributor - The modifier contributors to enforce.
        Returns:
        A new modifier adjustment that enforces the given modifier contributors and any previous adjustments.
      • withMethodModifiers

        public ModifierAdjustment withMethodModifiers​(java.util.List<? extends ModifierContributor.ForMethod> modifierContributors)
        Adjusts any method's modifiers.
        Parameters:
        modifierContributors - The modifier contributors to enforce.
        Returns:
        A new modifier adjustment that enforces the given modifier contributors and any previous adjustments.
      • withMethodModifiers

        public ModifierAdjustment withMethodModifiers​(ElementMatcher<? super MethodDescription> matcher,
                                                      ModifierContributor.ForMethod... modifierContributor)
        Adjusts a method's modifiers if it fulfills the supplied matcher.
        Parameters:
        matcher - The matcher that determines if a method's modifiers should be adjusted.
        modifierContributor - The modifier contributors to enforce.
        Returns:
        A new modifier adjustment that enforces the given modifier contributors and any previous adjustments.
      • withMethodModifiers

        public ModifierAdjustment withMethodModifiers​(ElementMatcher<? super MethodDescription> matcher,
                                                      java.util.List<? extends ModifierContributor.ForMethod> modifierContributors)
        Adjusts a method's modifiers if it fulfills the supplied matcher.
        Parameters:
        matcher - The matcher that determines if a method's modifiers should be adjusted.
        modifierContributors - The modifier contributors to enforce.
        Returns:
        A new modifier adjustment that enforces the given modifier contributors and any previous adjustments.
      • withConstructorModifiers

        public ModifierAdjustment withConstructorModifiers​(ModifierContributor.ForMethod... modifierContributor)
        Adjusts any constructor's modifiers.
        Parameters:
        modifierContributor - The modifier contributors to enforce.
        Returns:
        A new modifier adjustment that enforces the given modifier contributors and any previous adjustments.
      • withConstructorModifiers

        public ModifierAdjustment withConstructorModifiers​(java.util.List<? extends ModifierContributor.ForMethod> modifierContributors)
        Adjusts any constructor's modifiers.
        Parameters:
        modifierContributors - The modifier contributors to enforce.
        Returns:
        A new modifier adjustment that enforces the given modifier contributors and any previous adjustments.
      • withConstructorModifiers

        public ModifierAdjustment withConstructorModifiers​(ElementMatcher<? super MethodDescription> matcher,
                                                           ModifierContributor.ForMethod... modifierContributor)
        Adjusts a constructor's modifiers if it fulfills the supplied matcher.
        Parameters:
        matcher - The matcher that determines if a constructor's modifiers should be adjusted.
        modifierContributor - The modifier contributors to enforce.
        Returns:
        A new modifier adjustment that enforces the given modifier contributors and any previous adjustments.
      • withConstructorModifiers

        public ModifierAdjustment withConstructorModifiers​(ElementMatcher<? super MethodDescription> matcher,
                                                           java.util.List<? extends ModifierContributor.ForMethod> modifierContributors)
        Adjusts a constructor's modifiers if it fulfills the supplied matcher.
        Parameters:
        matcher - The matcher that determines if a constructor's modifiers should be adjusted.
        modifierContributors - The modifier contributors to enforce.
        Returns:
        A new modifier adjustment that enforces the given modifier contributors and any previous adjustments.
      • withInvokableModifiers

        public ModifierAdjustment withInvokableModifiers​(ModifierContributor.ForMethod... modifierContributor)
        Adjusts any method's or constructor's modifiers.
        Parameters:
        modifierContributor - The modifier contributors to enforce.
        Returns:
        A new modifier adjustment that enforces the given modifier contributors and any previous adjustments.
      • withInvokableModifiers

        public ModifierAdjustment withInvokableModifiers​(java.util.List<? extends ModifierContributor.ForMethod> modifierContributors)
        Adjusts any method's or constructor's modifiers.
        Parameters:
        modifierContributors - The modifier contributors to enforce.
        Returns:
        A new modifier adjustment that enforces the given modifier contributors and any previous adjustments.
      • withInvokableModifiers

        public ModifierAdjustment withInvokableModifiers​(ElementMatcher<? super MethodDescription> matcher,
                                                         ModifierContributor.ForMethod... modifierContributor)
        Adjusts a method's or constructor's modifiers if it fulfills the supplied matcher.
        Parameters:
        matcher - The matcher that determines if a method's or constructor's modifiers should be adjusted.
        modifierContributor - The modifier contributors to enforce.
        Returns:
        A new modifier adjustment that enforces the given modifier contributors and any previous adjustments.
      • withInvokableModifiers

        public ModifierAdjustment withInvokableModifiers​(ElementMatcher<? super MethodDescription> matcher,
                                                         java.util.List<? extends ModifierContributor.ForMethod> modifierContributors)
        Adjusts a method's or constructor's modifiers if it fulfills the supplied matcher.
        Parameters:
        matcher - The matcher that determines if a method's or constructor's modifiers should be adjusted.
        modifierContributors - The modifier contributors to enforce.
        Returns:
        A new modifier adjustment that enforces the given modifier contributors and any previous adjustments.
      • wrap

        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)
        Applies a ClassVisitorWrapper to the creation of a DynamicType.
        Parameters:
        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.
        Returns:
        A new ClassVisitor that usually delegates to the ClassVisitor delivered in the argument.