Exercise: Code Generation
Enhance your Kotlin skills by implementing a system for custom annotations and code generation.
We'll cover the following...
Problem statement
Implement a custom annotation called Validation
that defines validation rules for properties of a data class called Person
. Additionally, you need to create a processor called ValidationProcessor
to process these annotations at runtime.
You have the following annotations:
Press + to interact
@Retention(AnnotationRetention.RUNTIME)@Target(AnnotationTarget.PROPERTY)annotation class Validation(val minLength: Int = 0, val maxLength: Int = Int.MAX_VALUE, val validationType: ValidationType = ValidationType.NON_EMPTY)
Use the provided Person
...