Class AnnotationAppender.Default
- java.lang.Object
-
- net.bytebuddy.implementation.attribute.AnnotationAppender.Default
-
- All Implemented Interfaces:
AnnotationAppender
- Enclosing interface:
- AnnotationAppender
@Enhance public static class AnnotationAppender.Default extends java.lang.Object implements AnnotationAppender
A default implementation for an annotation appender that writes annotations to a given byte consumer represented by an ASMAnnotationVisitor.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface net.bytebuddy.implementation.attribute.AnnotationAppender
AnnotationAppender.Default, AnnotationAppender.ForTypeAnnotations, AnnotationAppender.Target
-
-
Field Summary
Fields Modifier and Type Field Description private AnnotationAppender.TargettargetThe target onto which an annotation write process is to be applied.-
Fields inherited from interface net.bytebuddy.implementation.attribute.AnnotationAppender
NO_NAME
-
-
Constructor Summary
Constructors Constructor Description Default(AnnotationAppender.Target target)Creates a default annotation appender.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description AnnotationAppenderappend(AnnotationDescription annotationDescription, AnnotationValueFilter annotationValueFilter)Writes the given annotation to the target that this appender represents.AnnotationAppenderappend(AnnotationDescription annotationDescription, AnnotationValueFilter annotationValueFilter, int typeReference, java.lang.String typePath)Writes the given type annotation to the target that this appender represents.static voidapply(org.objectweb.asm.AnnotationVisitor annotationVisitor, TypeDescription valueType, java.lang.String name, java.lang.Object value)Performs the writing of a given annotation value to an annotation visitor.private voiddoAppend(AnnotationDescription annotation, boolean visible, AnnotationValueFilter annotationValueFilter)Tries to append a given annotation by reflectively reading an annotation.private voiddoAppend(AnnotationDescription annotation, boolean visible, AnnotationValueFilter annotationValueFilter, int typeReference, java.lang.String typePath)Tries to append a given annotation by reflectively reading an annotation.private static voidhandle(org.objectweb.asm.AnnotationVisitor annotationVisitor, AnnotationDescription annotation, AnnotationValueFilter annotationValueFilter)Handles the writing of a single annotation to an annotation visitor.
-
-
-
Field Detail
-
target
private final AnnotationAppender.Target target
The target onto which an annotation write process is to be applied.
-
-
Constructor Detail
-
Default
public Default(AnnotationAppender.Target target)
Creates a default annotation appender.- Parameters:
target- The target to which annotations are written to.
-
-
Method Detail
-
handle
private static void handle(org.objectweb.asm.AnnotationVisitor annotationVisitor, AnnotationDescription annotation, AnnotationValueFilter annotationValueFilter)Handles the writing of a single annotation to an annotation visitor.- Parameters:
annotationVisitor- The annotation visitor the write process is to be applied on.annotation- The annotation to be written.annotationValueFilter- The value filter to apply for discovering which values of an annotation should be written.
-
apply
public static void apply(org.objectweb.asm.AnnotationVisitor annotationVisitor, TypeDescription valueType, java.lang.String name, java.lang.Object value)Performs the writing of a given annotation value to an annotation visitor.- Parameters:
annotationVisitor- The annotation visitor the write process is to be applied on.valueType- The type of the annotation value.name- The name of the annotation type.value- The annotation's value.
-
append
public AnnotationAppender append(AnnotationDescription annotationDescription, AnnotationValueFilter annotationValueFilter)
Writes the given annotation to the target that this appender represents.- Specified by:
appendin interfaceAnnotationAppender- Parameters:
annotationDescription- The annotation to be written.annotationValueFilter- The annotation value filter to use.- Returns:
- Usually
thisor any other annotation appender capable of writing another annotation to the specified target.
-
doAppend
private void doAppend(AnnotationDescription annotation, boolean visible, AnnotationValueFilter annotationValueFilter)
Tries to append a given annotation by reflectively reading an annotation.- Parameters:
annotation- The annotation to be written.visible-trueif this annotation should be treated as visible at runtime.annotationValueFilter- The annotation value filter to apply.
-
append
public AnnotationAppender append(AnnotationDescription annotationDescription, AnnotationValueFilter annotationValueFilter, int typeReference, java.lang.String typePath)
Writes the given type annotation to the target that this appender represents.- Specified by:
appendin interfaceAnnotationAppender- Parameters:
annotationDescription- The annotation to be written.annotationValueFilter- The annotation value filter to use.typeReference- The type variable's type reference.typePath- The type variable's type path.- Returns:
- Usually
thisor any other annotation appender capable of writing another annotation to the specified target.
-
doAppend
private void doAppend(AnnotationDescription annotation, boolean visible, AnnotationValueFilter annotationValueFilter, int typeReference, java.lang.String typePath)
Tries to append a given annotation by reflectively reading an annotation.- Parameters:
annotation- The annotation to be written.visible-trueif this annotation should be treated as visible at runtime.annotationValueFilter- The annotation value filter to apply.typeReference- The type annotation's type reference.typePath- The type annotation's type path.
-
-