AnnotationInfo

data class AnnotationInfo(val type: KClass<out Annotation>, val typeName: String, val args: List<Any?>, val parameterNames: List<String>)(source)

Holds metadata about a single annotation instance present on a method or parameter.

Instances are created at compile time by the AspectK compiler plugin and embedded inside MethodSignature or MethodParameter. They allow advice methods to inspect annotation details at runtime without incurring additional reflection overhead.

Only arguments that are explicitly provided in source are included in args; omitted optional arguments (those relying on their default values) are not present.

Mapping args to parameterNames

args and parameterNames are parallel lists: args[i] is the value of the annotation parameter named parameterNames[i]. Use zip to iterate them together:

val annotationInfo: AnnotationInfo = ...
annotationInfo.parameterNames.zip(annotationInfo.args).forEach { (name, value) ->
println("$name = $value")
}

Constructors

Link copied to clipboard
constructor(type: KClass<out Annotation>, typeName: String, args: List<Any?>, parameterNames: List<String>)

Properties

Link copied to clipboard
val args: List<Any?>

The list of argument values supplied to the annotation, in declaration order. Only explicitly provided arguments are present; default values are omitted.

Link copied to clipboard

The names of the annotation parameters corresponding to each entry in args, in the same order. Always has the same length as args.

Link copied to clipboard

The KClass of the annotation.

Link copied to clipboard

The fully-qualified class name of the annotation as a String.