Class RepeatedAnnotationPlugin
java.lang.Object
net.bytebuddy.build.Plugin.ForElementMatcher
net.bytebuddy.build.RepeatedAnnotationPlugin
- All Implemented Interfaces:
Closeable, AutoCloseable, Plugin, Plugin.Factory, ElementMatcher<TypeDescription>
@Enhance
public class RepeatedAnnotationPlugin
extends Plugin.ForElementMatcher
implements Plugin.Factory
A plugin that allows for adding a
java.lang.annotation.Repeatable annotation even if compiled prior to
Java 8 which introduces this annotation. As the annotation is not present on previous JVM versions, it is ignored
at runtime for older JVM versions what makes this approach feasible.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic @interfaceIndicates that the annotated annotation should be repeatable by the supplied annotation.protected static classA type attribute appender that adds a repeated annotation for a target type.Nested classes/interfaces inherited from interface ElementMatcher
ElementMatcher.Junction<S>Nested 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 -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final MethodDescription.InDefinedShapeA description of theRepeatedAnnotationPlugin.Enhance.value()method. -
Constructor Summary
ConstructorsConstructorDescriptionCreates a new plugin for creating repeated annotations. -
Method Summary
Modifier and TypeMethodDescriptionapply(DynamicType.Builder<?> builder, TypeDescription typeDescription, ClassFileLocator classFileLocator) Applies this plugin.voidclose()make()Returns a plugin that can be used for a transformation and which is subsequently closed.Methods inherited from class Plugin.ForElementMatcher
matches
-
Field Details
-
VALUE
A description of theRepeatedAnnotationPlugin.Enhance.value()method.
-
-
Constructor Details
-
RepeatedAnnotationPlugin
public RepeatedAnnotationPlugin()Creates a new plugin for creating repeated annotations.
-
-
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
-