I was wondering if you could clear up something for me. If nobody knows, I can still consult the resulting bytecode, but you might know how much fun this is and forgive me for asking (after I searched google and the issue tracker, and did not find any relating information).
Please consider the class Cargo. To allow persistence of this class, but without polluting the domain model with persistence/infrastructure information, the DDD folks have decided to move this information outside.
Now, I am not a big fan of run-time XML validation, so I was wondering, if Kotlin could help me to solve this problem with an extension of annotations on getter functions.
Assuming this simplified pseudo code:
data class Cargo ( val trackingId:TrackingId, val routeSpecification:RouteSpecification )
Wouldn’t it be sweet, if we could extend those properties with annotations, e.g.:
fun @Column("tracking_id") Cargo.trackingId; fun @ManyToOne Cargo.trackingId;
With this, we could separate persistence and domain concerns, whilst still allowing compile-time checking our persistence information.
So my question is: Is something like this already possible, planned, or where can I make a suggestion + who else would like to see this (relatively easy byte-code manipulation).
And yes, I know that this is already possible with AspectJ, but to me kotlin is all about finding the sweet spot between productivity and readability, which aspectJ has not really paid much attention to (apart from the awesome eclipse plugin, which is of little use in the even more awesome idea IDE).