Package-level declarations

Types

Link copied to clipboard
annotation class After(val target: KClass<out Annotation>, val inherits: Boolean = false)

Marks a function inside an Aspect-annotated class as after advice.

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

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

Link copied to clipboard
annotation class Around(val target: KClass<out Annotation>, val inherits: Boolean = false)

Marks a function inside an Aspect-annotated class as around advice.

Link copied to clipboard
@Target(allowedTargets = [AnnotationTarget.CLASS])
annotation class Aspect

Marks a class or object as an AspectK aspect.

Link copied to clipboard
annotation class Before(val target: KClass<out Annotation>, val inherits: Boolean = false)

Marks a function inside an Aspect-annotated class as before advice.

Link copied to clipboard
interface JoinPoint

Provides contextual information about an intercepted function call.

Link copied to clipboard
data class MethodParameter(val name: String, val type: KClass<*>, val typeName: String, val annotations: List<AnnotationInfo>, val isNullable: Boolean)

Describes a single parameter of an intercepted method.

Link copied to clipboard
data class MethodSignature(val methodName: String, val annotations: List<AnnotationInfo>, val parameter: List<MethodParameter>, val returnType: KClass<*>, val returnTypeName: String)

Compile-time metadata describing the signature of an intercepted method.

Link copied to clipboard

Extends JoinPoint with the ability to proceed to the intercepted function's body.

Functions

Link copied to clipboard

Returns the AnnotationInfo for annotation T present on the intercepted function, or null if no such annotation is present.

Returns the AnnotationInfo for annotation T present on this method signature, or null if no such annotation is present.

Link copied to clipboard
inline fun <T> AnnotationInfo.getArg(paramName: String): T

Returns the annotation argument value for the parameter named paramName, cast to T.

inline fun <T> JoinPoint.getArg(name: String): T

Returns the argument value for the parameter named name, cast to T.

Link copied to clipboard
inline fun <T> AnnotationInfo.getArgOrNull(paramName: String): T?

Returns the annotation argument value for the parameter named paramName, cast to T, or null if no such parameter exists or the value cannot be cast to T.

inline fun <T> JoinPoint.getArgOrNull(name: String): T?

Returns the argument value for the parameter named name, cast to T, or null if no such parameter exists or the value cannot be cast to T.

Link copied to clipboard
inline fun <T> JoinPoint.getTarget(): T

Returns JoinPoint.target cast to T.

Link copied to clipboard
inline fun <T> JoinPoint.getTargetOrNull(): T?

Returns JoinPoint.target cast to T, or null if the target is null or cannot be cast to T.