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 an HashCodeAndEqualsPlugin.Enhance 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.
  • 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 interface Plugin
      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 interface AutoCloseable
      Specified by:
      close in interface Closeable
    • make

      public MethodAttributeAppender make(TypeDescription typeDescription)
      Returns a method attribute appender that is applicable for a given type description.
      Specified by:
      make in interface MethodAttributeAppender.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 interface MethodAttributeAppender
      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.