November 2018
Intermediate to advanced
388 pages
9h 5m
English
Let's create a custom annotation, such as Auditable, to audit a business function in an application:
@InterceptorBinding@Retention(RetentionPolicy.RUNTIME)@Documentedannotation class Auditable
The Auditable annotation is itself annotated with @InterceptorBinding and has a runtime retention policy to make the annotation visible at runtime.
We can use Auditable in business functions as follows:
@Statelessclass App { @Inject private lateinit var identityCreator: IdentityCreator @Inject private lateinit var identityRepository: IdentityRepository @Auditable fun createIdentity(inputData: InputData): Identity { val person = identityCreator.createPerson(inputData) identityRepository.store(person) return person }}
Read now
Unlock full access