Package net.bytebuddy.build
Class DispatcherAnnotationPlugin
java.lang.Object
net.bytebuddy.build.Plugin.ForElementMatcher
net.bytebuddy.build.DispatcherAnnotationPlugin
- All Implemented Interfaces:
Closeable
,AutoCloseable
,Plugin
,MethodAttributeAppender
,MethodAttributeAppender.Factory
,ElementMatcher<TypeDescription>
@Enhance
public class DispatcherAnnotationPlugin
extends Plugin.ForElementMatcher
implements MethodAttributeAppender.Factory, MethodAttributeAppender
A plugin that adds a
JavaDispatcher.Proxied
annotation to any method of an
enhanced type where the annotation is not set. This aids in supporting obfuscators that rename methods which
makes reflection-based lookup by the proxy interface's name impossible.-
Nested Class Summary
Nested classes/interfaces inherited from interface net.bytebuddy.matcher.ElementMatcher
ElementMatcher.Junction<S>
Nested classes/interfaces inherited from interface net.bytebuddy.implementation.attribute.MethodAttributeAppender
MethodAttributeAppender.Compound, MethodAttributeAppender.Explicit, MethodAttributeAppender.Factory, MethodAttributeAppender.ForInstrumentedMethod, MethodAttributeAppender.ForReceiverType, MethodAttributeAppender.NoOp
Nested classes/interfaces inherited from interface net.bytebuddy.implementation.attribute.MethodAttributeAppender.Factory
MethodAttributeAppender.Factory.Compound
Nested classes/interfaces inherited from interface net.bytebuddy.build.Plugin
Plugin.Engine, Plugin.Factory, Plugin.ForElementMatcher, Plugin.NoOp, Plugin.WithInitialization, Plugin.WithPreprocessor
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionapply
(DynamicType.Builder<?> builder, TypeDescription typeDescription, ClassFileLocator classFileLocator) Applies this plugin.void
apply
(org.objectweb.asm.MethodVisitor methodVisitor, MethodDescription methodDescription, AnnotationValueFilter annotationValueFilter) Applies this attribute appender to a given method visitor.void
close()
make
(TypeDescription typeDescription) Returns a method attribute appender that is applicable for a given type description.Methods inherited from class net.bytebuddy.build.Plugin.ForElementMatcher
matches
-
Constructor Details
-
DispatcherAnnotationPlugin
public DispatcherAnnotationPlugin()Creates a new dispatcher annotation plugin.
-
-
Method Details
-
apply
public DynamicType.Builder<?> apply(DynamicType.Builder<?> builder, TypeDescription typeDescription, ClassFileLocator classFileLocator) Applies this plugin.- Specified by:
apply
in interfacePlugin
- Parameters:
builder
- The builder to use as a basis for the applied transformation.typeDescription
- The type being transformed.classFileLocator
- A class file locator that can locate other types in the scope of the project.- Returns:
- The supplied builder with additional transformations registered.
-
close
public void close()- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
-
make
Returns a method attribute appender that is applicable for a given type description.- Specified by:
make
in interfaceMethodAttributeAppender.Factory
- Parameters:
typeDescription
- The type for which a method attribute appender is to be applied for.- Returns:
- The method attribute appender which should be applied for the given type.
-
apply
public void apply(org.objectweb.asm.MethodVisitor methodVisitor, MethodDescription methodDescription, AnnotationValueFilter annotationValueFilter) Applies this attribute appender to a given method visitor.- Specified by:
apply
in interfaceMethodAttributeAppender
- Parameters:
methodVisitor
- The method visitor to which the attributes that are represented by this attribute appender are written to.methodDescription
- The description of the method for which the given method visitor creates an instrumentation for.annotationValueFilter
- The annotation value filter to apply when the annotations are written.
-