Class AnnotationAppender.ForTypeAnnotations
java.lang.Object
net.bytebuddy.implementation.attribute.AnnotationAppender.ForTypeAnnotations
- All Implemented Interfaces:
TypeDescription.Generic.Visitor<AnnotationAppender>
- Enclosing interface:
AnnotationAppender
@Enhance
public static class AnnotationAppender.ForTypeAnnotations
extends Object
implements TypeDescription.Generic.Visitor<AnnotationAppender>
A type visitor that visits all type annotations of a generic type and writes any discovered annotation to a
supplied
AnnotationAppender
.-
Nested Class Summary
Nested classes/interfaces inherited from interface net.bytebuddy.description.type.TypeDescription.Generic.Visitor
TypeDescription.Generic.Visitor.AnnotationStripper, TypeDescription.Generic.Visitor.Assigner, TypeDescription.Generic.Visitor.ForRawType, TypeDescription.Generic.Visitor.ForSignatureVisitor, TypeDescription.Generic.Visitor.NoOp, TypeDescription.Generic.Visitor.Reducing, TypeDescription.Generic.Visitor.Reifying, TypeDescription.Generic.Visitor.Substitutor, TypeDescription.Generic.Visitor.TypeErasing, TypeDescription.Generic.Visitor.Validator
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final AnnotationAppender
The annotation appender to use.private final AnnotationValueFilter
The annotation value filter to use.private static final char
Represents a step to a component type within a type path.private static final String
Represents an empty type path.private static final char
Represents an index type delimiter within a type path.private static final char
Represents a (reversed) type step to an inner class within a type path.private static final int
The index that indicates that super type type annotations are written onto a super class.private final String
The type path to use.private final int
The type reference to use.static final boolean
Indicates that type variables type annotations are written on a Java method or constructor.static final boolean
Indicates that type variables type annotations are written on a Java type.private static final char
Represents a wildcard type step within a type path. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
ForTypeAnnotations
(AnnotationAppender annotationAppender, AnnotationValueFilter annotationValueFilter, int typeReference, String typePath) Creates a new type annotation appending visitor.protected
ForTypeAnnotations
(AnnotationAppender annotationAppender, AnnotationValueFilter annotationValueFilter, org.objectweb.asm.TypeReference typeReference) Creates a new type annotation appending visitor for an empty type path. -
Method Summary
Modifier and TypeMethodDescriptionprivate AnnotationAppender
apply
(TypeDescription.Generic typeDescription, String typePath) Writes all annotations of the supplied type to this instance's annotation appender.ofExceptionType
(AnnotationAppender annotationAppender, AnnotationValueFilter annotationValueFilter, int index) Creates a type annotation appender for type annotations of a method's exception type.ofFieldType
(AnnotationAppender annotationAppender, AnnotationValueFilter annotationValueFilter) Creates a type annotation appender for type annotations of a field's type.ofInterfaceType
(AnnotationAppender annotationAppender, AnnotationValueFilter annotationValueFilter, int index) Creates a type annotation appender for type annotations of an interface type.ofMethodParameterType
(AnnotationAppender annotationAppender, AnnotationValueFilter annotationValueFilter, int index) Creates a type annotation appender for type annotations of a method's parameter type.ofMethodReturnType
(AnnotationAppender annotationAppender, AnnotationValueFilter annotationValueFilter) Creates a type annotation appender for type annotations of a method's return type.ofReceiverType
(AnnotationAppender annotationAppender, AnnotationValueFilter annotationValueFilter) Creates a type annotation appender for type annotations of a method's receiver type.ofSuperClass
(AnnotationAppender annotationAppender, AnnotationValueFilter annotationValueFilter) Creates a type annotation appender for a type annotations of a super class type.static AnnotationAppender
ofTypeVariable
(AnnotationAppender annotationAppender, AnnotationValueFilter annotationValueFilter, boolean variableOnType, int subListIndex, List<? extends TypeDescription.Generic> typeVariables) Appends all supplied type variables to the supplied method appender.static AnnotationAppender
ofTypeVariable
(AnnotationAppender annotationAppender, AnnotationValueFilter annotationValueFilter, boolean variableOnType, List<? extends TypeDescription.Generic> typeVariables) Appends all supplied type variables to the supplied method appender.onGenericArray
(TypeDescription.Generic genericArray) Visits a generic array type (TypeDefinition.Sort.GENERIC_ARRAY
).onNonGenericType
(TypeDescription.Generic typeDescription) Visits a non-generic type (TypeDefinition.Sort.NON_GENERIC
).onParameterizedType
(TypeDescription.Generic parameterizedType) Visits a parameterized type (TypeDefinition.Sort.PARAMETERIZED
).onTypeVariable
(TypeDescription.Generic typeVariable) Visits a type variable (TypeDefinition.Sort.VARIABLE
,TypeDefinition.Sort.VARIABLE_SYMBOLIC
).onWildcard
(TypeDescription.Generic wildcard) Visits a wildcard (TypeDefinition.Sort.WILDCARD
).
-
Field Details
-
VARIABLE_ON_TYPE
public static final boolean VARIABLE_ON_TYPEIndicates that type variables type annotations are written on a Java type.- See Also:
-
VARIABLE_ON_INVOKEABLE
public static final boolean VARIABLE_ON_INVOKEABLEIndicates that type variables type annotations are written on a Java method or constructor.- See Also:
-
EMPTY_TYPE_PATH
Represents an empty type path.- See Also:
-
COMPONENT_TYPE_PATH
private static final char COMPONENT_TYPE_PATHRepresents a step to a component type within a type path.- See Also:
-
WILDCARD_TYPE_PATH
private static final char WILDCARD_TYPE_PATHRepresents a wildcard type step within a type path.- See Also:
-
INNER_CLASS_PATH
private static final char INNER_CLASS_PATHRepresents a (reversed) type step to an inner class within a type path.- See Also:
-
INDEXED_TYPE_DELIMITER
private static final char INDEXED_TYPE_DELIMITERRepresents an index type delimiter within a type path.- See Also:
-
SUPER_CLASS_INDEX
private static final int SUPER_CLASS_INDEXThe index that indicates that super type type annotations are written onto a super class.- See Also:
-
annotationAppender
The annotation appender to use. -
annotationValueFilter
The annotation value filter to use. -
typeReference
private final int typeReferenceThe type reference to use. -
typePath
The type path to use.
-
-
Constructor Details
-
ForTypeAnnotations
protected ForTypeAnnotations(AnnotationAppender annotationAppender, AnnotationValueFilter annotationValueFilter, org.objectweb.asm.TypeReference typeReference) Creates a new type annotation appending visitor for an empty type path.- Parameters:
annotationAppender
- The annotation appender to use.annotationValueFilter
- The annotation value filter to use.typeReference
- The type reference to use.
-
ForTypeAnnotations
protected ForTypeAnnotations(AnnotationAppender annotationAppender, AnnotationValueFilter annotationValueFilter, int typeReference, String typePath) Creates a new type annotation appending visitor.- Parameters:
annotationAppender
- The annotation appender to use.annotationValueFilter
- The annotation value filter to use.typeReference
- The type reference to use.typePath
- The type path to use.
-
-
Method Details
-
ofSuperClass
public static TypeDescription.Generic.Visitor<AnnotationAppender> ofSuperClass(AnnotationAppender annotationAppender, AnnotationValueFilter annotationValueFilter) Creates a type annotation appender for a type annotations of a super class type.- Parameters:
annotationAppender
- The annotation appender to write any type annotation to.annotationValueFilter
- The annotation value filter to apply.- Returns:
- A visitor for appending type annotations of a super class.
-
ofInterfaceType
public static TypeDescription.Generic.Visitor<AnnotationAppender> ofInterfaceType(AnnotationAppender annotationAppender, AnnotationValueFilter annotationValueFilter, int index) Creates a type annotation appender for type annotations of an interface type.- Parameters:
annotationAppender
- The annotation appender to write any type annotation to.annotationValueFilter
- The annotation value filter to apply.index
- The index of the interface type.- Returns:
- A visitor for appending type annotations of an interface type.
-
ofFieldType
public static TypeDescription.Generic.Visitor<AnnotationAppender> ofFieldType(AnnotationAppender annotationAppender, AnnotationValueFilter annotationValueFilter) Creates a type annotation appender for type annotations of a field's type.- Parameters:
annotationAppender
- The annotation appender to write any type annotation to.annotationValueFilter
- The annotation value filter to apply.- Returns:
- A visitor for appending type annotations of a field's type.
-
ofMethodReturnType
public static TypeDescription.Generic.Visitor<AnnotationAppender> ofMethodReturnType(AnnotationAppender annotationAppender, AnnotationValueFilter annotationValueFilter) Creates a type annotation appender for type annotations of a method's return type.- Parameters:
annotationAppender
- The annotation appender to write any type annotation to.annotationValueFilter
- The annotation value filter to apply.- Returns:
- A visitor for appending type annotations of a method's return type.
-
ofMethodParameterType
public static TypeDescription.Generic.Visitor<AnnotationAppender> ofMethodParameterType(AnnotationAppender annotationAppender, AnnotationValueFilter annotationValueFilter, int index) Creates a type annotation appender for type annotations of a method's parameter type.- Parameters:
annotationAppender
- The annotation appender to write any type annotation to.annotationValueFilter
- The annotation value filter to apply.index
- The parameter index.- Returns:
- A visitor for appending type annotations of a method's parameter type.
-
ofExceptionType
public static TypeDescription.Generic.Visitor<AnnotationAppender> ofExceptionType(AnnotationAppender annotationAppender, AnnotationValueFilter annotationValueFilter, int index) Creates a type annotation appender for type annotations of a method's exception type.- Parameters:
annotationAppender
- The annotation appender to write any type annotation to.annotationValueFilter
- The annotation value filter to apply.index
- The exception type's index.- Returns:
- A visitor for appending type annotations of a method's exception type.
-
ofReceiverType
public static TypeDescription.Generic.Visitor<AnnotationAppender> ofReceiverType(AnnotationAppender annotationAppender, AnnotationValueFilter annotationValueFilter) Creates a type annotation appender for type annotations of a method's receiver type.- Parameters:
annotationAppender
- The annotation appender to write any type annotation to.annotationValueFilter
- The annotation value filter to apply.- Returns:
- A visitor for appending type annotations of a method's receiver type.
-
ofTypeVariable
public static AnnotationAppender ofTypeVariable(AnnotationAppender annotationAppender, AnnotationValueFilter annotationValueFilter, boolean variableOnType, List<? extends TypeDescription.Generic> typeVariables) Appends all supplied type variables to the supplied method appender.- Parameters:
annotationAppender
- The annotation appender to write any type annotation to.annotationValueFilter
- The annotation value filter to apply.variableOnType
-true
if the type variables are declared by a type,false
if they are declared by a method.typeVariables
- The type variables to append.- Returns:
- The resulting annotation appender.
-
ofTypeVariable
public static AnnotationAppender ofTypeVariable(AnnotationAppender annotationAppender, AnnotationValueFilter annotationValueFilter, boolean variableOnType, int subListIndex, List<? extends TypeDescription.Generic> typeVariables) Appends all supplied type variables to the supplied method appender.- Parameters:
annotationAppender
- The annotation appender to write any type annotation to.annotationValueFilter
- The annotation value filter to apply.variableOnType
-true
if the type variables are declared by a type,false
if they are declared by a method.subListIndex
- The index of the first type variable to append. All previous type variables are ignored.typeVariables
- The type variables to append.- Returns:
- The resulting annotation appender.
-
onGenericArray
Visits a generic array type (TypeDefinition.Sort.GENERIC_ARRAY
).- Specified by:
onGenericArray
in interfaceTypeDescription.Generic.Visitor<AnnotationAppender>
- Parameters:
genericArray
- The generic array type.- Returns:
- The visitor's return value.
-
onWildcard
Visits a wildcard (TypeDefinition.Sort.WILDCARD
).- Specified by:
onWildcard
in interfaceTypeDescription.Generic.Visitor<AnnotationAppender>
- Parameters:
wildcard
- The wildcard.- Returns:
- The visitor's return value.
-
onParameterizedType
Visits a parameterized type (TypeDefinition.Sort.PARAMETERIZED
).- Specified by:
onParameterizedType
in interfaceTypeDescription.Generic.Visitor<AnnotationAppender>
- Parameters:
parameterizedType
- The generic array type.- Returns:
- The visitor's return value.
-
onTypeVariable
Visits a type variable (TypeDefinition.Sort.VARIABLE
,TypeDefinition.Sort.VARIABLE_SYMBOLIC
).- Specified by:
onTypeVariable
in interfaceTypeDescription.Generic.Visitor<AnnotationAppender>
- Parameters:
typeVariable
- The generic array type.- Returns:
- The visitor's return value.
-
onNonGenericType
Visits a non-generic type (TypeDefinition.Sort.NON_GENERIC
).- Specified by:
onNonGenericType
in interfaceTypeDescription.Generic.Visitor<AnnotationAppender>
- Parameters:
typeDescription
- The non-generic type.- Returns:
- The visitor's return value.
-
apply
Writes all annotations of the supplied type to this instance's annotation appender.- Parameters:
typeDescription
- The type of what all annotations should be written of.typePath
- The type path to use.- Returns:
- The resulting annotation appender.
-