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 java.lang.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 suppliedAnnotationAppender
.
-
-
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
Fields Modifier and Type Field Description private AnnotationAppender
annotationAppender
The annotation appender to use.private AnnotationValueFilter
annotationValueFilter
The annotation value filter to use.private static char
COMPONENT_TYPE_PATH
Represents a step to a component type within a type path.private static java.lang.String
EMPTY_TYPE_PATH
Represents an empty type path.private static char
INDEXED_TYPE_DELIMITER
Represents an index type delimiter within a type path.private static char
INNER_CLASS_PATH
Represents a (reversed) type step to an inner class within a type path.private static int
SUPER_CLASS_INDEX
The index that indicates that super type type annotations are written onto a super class.private java.lang.String
typePath
The type path to use.private int
typeReference
The type reference to use.static boolean
VARIABLE_ON_INVOKEABLE
Indicates that type variables type annotations are written on a Java method or constructor.static boolean
VARIABLE_ON_TYPE
Indicates that type variables type annotations are written on a Java type.private static char
WILDCARD_TYPE_PATH
Represents a wildcard type step within a type path.
-
Constructor Summary
Constructors Modifier Constructor Description protected
ForTypeAnnotations(AnnotationAppender annotationAppender, AnnotationValueFilter annotationValueFilter, int typeReference, java.lang.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
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private AnnotationAppender
apply(TypeDescription.Generic typeDescription, java.lang.String typePath)
Writes all annotations of the supplied type to this instance's annotation appender.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.static TypeDescription.Generic.Visitor<AnnotationAppender>
ofFieldType(AnnotationAppender annotationAppender, AnnotationValueFilter annotationValueFilter)
Creates a type annotation appender for type annotations of a field's type.static TypeDescription.Generic.Visitor<AnnotationAppender>
ofInterfaceType(AnnotationAppender annotationAppender, AnnotationValueFilter annotationValueFilter, int index)
Creates a type annotation appender for type annotations of an interface type.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.static TypeDescription.Generic.Visitor<AnnotationAppender>
ofMethodReturnType(AnnotationAppender annotationAppender, AnnotationValueFilter annotationValueFilter)
Creates a type annotation appender for type annotations of a method's return type.static TypeDescription.Generic.Visitor<AnnotationAppender>
ofReceiverType(AnnotationAppender annotationAppender, AnnotationValueFilter annotationValueFilter)
Creates a type annotation appender for type annotations of a method's receiver type.static TypeDescription.Generic.Visitor<AnnotationAppender>
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, java.util.List<? extends TypeDescription.Generic> typeVariables)
Appends all supplied type variables to the supplied method appender.static AnnotationAppender
ofTypeVariable(AnnotationAppender annotationAppender, AnnotationValueFilter annotationValueFilter, boolean variableOnType, java.util.List<? extends TypeDescription.Generic> typeVariables)
Appends all supplied type variables to the supplied method appender.AnnotationAppender
onGenericArray(TypeDescription.Generic genericArray)
Visits a generic array type (TypeDefinition.Sort.GENERIC_ARRAY
).AnnotationAppender
onNonGenericType(TypeDescription.Generic typeDescription)
Visits a non-generic type (TypeDefinition.Sort.NON_GENERIC
).AnnotationAppender
onParameterizedType(TypeDescription.Generic parameterizedType)
Visits a parameterized type (TypeDefinition.Sort.PARAMETERIZED
).AnnotationAppender
onTypeVariable(TypeDescription.Generic typeVariable)
Visits a type variable (TypeDefinition.Sort.VARIABLE
,TypeDefinition.Sort.VARIABLE_SYMBOLIC
).AnnotationAppender
onWildcard(TypeDescription.Generic wildcard)
Visits a wildcard (TypeDefinition.Sort.WILDCARD
).
-
-
-
Field Detail
-
VARIABLE_ON_TYPE
public static final boolean VARIABLE_ON_TYPE
Indicates that type variables type annotations are written on a Java type.- See Also:
- Constant Field Values
-
VARIABLE_ON_INVOKEABLE
public static final boolean VARIABLE_ON_INVOKEABLE
Indicates that type variables type annotations are written on a Java method or constructor.- See Also:
- Constant Field Values
-
EMPTY_TYPE_PATH
private static final java.lang.String EMPTY_TYPE_PATH
Represents an empty type path.- See Also:
- Constant Field Values
-
COMPONENT_TYPE_PATH
private static final char COMPONENT_TYPE_PATH
Represents a step to a component type within a type path.- See Also:
- Constant Field Values
-
WILDCARD_TYPE_PATH
private static final char WILDCARD_TYPE_PATH
Represents a wildcard type step within a type path.- See Also:
- Constant Field Values
-
INNER_CLASS_PATH
private static final char INNER_CLASS_PATH
Represents a (reversed) type step to an inner class within a type path.- See Also:
- Constant Field Values
-
INDEXED_TYPE_DELIMITER
private static final char INDEXED_TYPE_DELIMITER
Represents an index type delimiter within a type path.- See Also:
- Constant Field Values
-
SUPER_CLASS_INDEX
private static final int SUPER_CLASS_INDEX
The index that indicates that super type type annotations are written onto a super class.- See Also:
- Constant Field Values
-
annotationAppender
private final AnnotationAppender annotationAppender
The annotation appender to use.
-
annotationValueFilter
private final AnnotationValueFilter annotationValueFilter
The annotation value filter to use.
-
typeReference
private final int typeReference
The type reference to use.
-
typePath
private final java.lang.String typePath
The type path to use.
-
-
Constructor Detail
-
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, java.lang.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 Detail
-
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, java.util.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, java.util.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
public AnnotationAppender onGenericArray(TypeDescription.Generic genericArray)
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
public AnnotationAppender onWildcard(TypeDescription.Generic wildcard)
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
public AnnotationAppender onParameterizedType(TypeDescription.Generic parameterizedType)
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
public AnnotationAppender onTypeVariable(TypeDescription.Generic typeVariable)
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
public AnnotationAppender onNonGenericType(TypeDescription.Generic typeDescription)
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
private AnnotationAppender apply(TypeDescription.Generic typeDescription, java.lang.String typePath)
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.
-
-