toStaticAggregateIdGetterIfAnnotated
Creates a property getter for the static aggregate ID if the class is annotated with @StaticAggregateId.
This method scans the class for the @StaticAggregateId annotation and, if present, creates a property getter for the specified aggregate ID property.
Example usage:
@StaticAggregateId(aggregateId = "fixed-order-id")
class OrderAggregate
val idGetter = OrderAggregate::class.toStaticAggregateIdGetterIfAnnotated()
val id = idGetter?.get(OrderAggregate()) // Returns "fixed-order-id"Content copied to clipboard
Return
a PropertyGetter for the static aggregate ID, or null if the class is not annotated
Parameters
T
the type of the class