Class DispatcherAnnotationPlugin
java.lang.Object
net.bytebuddy.build.Plugin.ForElementMatcher
net.bytebuddy.build.DispatcherAnnotationPlugin
- All Implemented Interfaces:
Closeable, AutoCloseable, Plugin, Plugin.Factory, MethodAttributeAppender, MethodAttributeAppender.Factory, ElementMatcher<TypeDescription>
@Enhance
public class DispatcherAnnotationPlugin
extends Plugin.ForElementMatcher
implements Plugin.Factory, 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 ElementMatcher
ElementMatcher.Junction<S>Nested classes/interfaces inherited from interface MethodAttributeAppender
MethodAttributeAppender.Compound, MethodAttributeAppender.Explicit, MethodAttributeAppender.Factory, MethodAttributeAppender.ForInstrumentedMethod, MethodAttributeAppender.ForReceiverType, MethodAttributeAppender.NoOpNested classes/interfaces inherited from interface MethodAttributeAppender.Factory
MethodAttributeAppender.Factory.CompoundNested classes/interfaces inherited from interface Plugin
Plugin.Engine, Plugin.Factory, Plugin.ForElementMatcher, Plugin.NoOp, Plugin.WithInitialization, Plugin.WithPreprocessorNested classes/interfaces inherited from interface Plugin.Factory
Plugin.Factory.Simple, Plugin.Factory.UsingReflection -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionapply(DynamicType.Builder<?> builder, TypeDescription typeDescription, ClassFileLocator classFileLocator) Applies this plugin.voidapply(org.objectweb.asm.MethodVisitor methodVisitor, MethodDescription methodDescription, AnnotationValueFilter annotationValueFilter) Applies this attribute appender to a given method visitor.voidclose()make()Returns a plugin that can be used for a transformation and which is subsequently closed.make(TypeDescription typeDescription) Returns a method attribute appender that is applicable for a given type description.Methods inherited from class Plugin.ForElementMatcher
matches
-
Constructor Details
-
DispatcherAnnotationPlugin
public DispatcherAnnotationPlugin()Creates a new dispatcher annotation plugin.
-
-
Method Details
-
make
Returns a plugin that can be used for a transformation and which is subsequently closed.- Specified by:
makein interfacePlugin.Factory- Returns:
- The plugin to use for type transformations.
-
apply
public DynamicType.Builder<?> apply(DynamicType.Builder<?> builder, TypeDescription typeDescription, ClassFileLocator classFileLocator) Applies this plugin.- Specified by:
applyin 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:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable
-
make
Returns a method attribute appender that is applicable for a given type description.- Specified by:
makein 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:
applyin 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.
-