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 TypeDescription.Generic.Visitor
TypeDescription.Generic.Visitor.AnnotationStripper, TypeDescription.Generic.Visitor.Assigner, TypeDescription.Generic.Visitor.ForRawType, TypeDescription.Generic.Visitor.ForSignatureVisitor, TypeDescription.Generic.Visitor.Generalizing, 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 TypeFieldDescriptionstatic final booleanIndicates that type variables type annotations are written on a Java method or constructor.static final booleanIndicates that type variables type annotations are written on a Java type. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedForTypeAnnotations(AnnotationAppender annotationAppender, AnnotationValueFilter annotationValueFilter, int typeReference, String typePath) Creates a new type annotation appending visitor.protectedForTypeAnnotations(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 TypeMethodDescriptionofExceptionType(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 AnnotationAppenderofTypeVariable(AnnotationAppender annotationAppender, AnnotationValueFilter annotationValueFilter, boolean variableOnType, int subListIndex, List<? extends TypeDescription.Generic> typeVariables) Appends all supplied type variables to the supplied method appender.static AnnotationAppenderofTypeVariable(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:
-
-
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-trueif the type variables are declared by a type,falseif 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-trueif the type variables are declared by a type,falseif 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:
onGenericArrayin 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:
onWildcardin interfaceTypeDescription.Generic.Visitor<AnnotationAppender>- Parameters:
wildcard- The wildcard.- Returns:
- The visitor's return value.
-
onParameterizedType
Visits a parameterized type (TypeDefinition.Sort.PARAMETERIZED).- Specified by:
onParameterizedTypein 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:
onTypeVariablein 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:
onNonGenericTypein interfaceTypeDescription.Generic.Visitor<AnnotationAppender>- Parameters:
typeDescription- The non-generic type.- Returns:
- The visitor's return value.
-