toAggregateNameGetterIfAnnotated
Creates a property getter for the aggregate name if the property is annotated with @AggregateName.
This method scans the property for the @AggregateName annotation and, if present, converts the property to a string getter for accessing the aggregate name.
Example usage:
class OrderCommand(
@AggregateName
val aggregateName: String = "order"
)
val command = OrderCommand()
val nameGetter = OrderCommand::aggregateName.toAggregateNameGetterIfAnnotated()
val name = nameGetter?.get(command) // Returns "order"Content copied to clipboard
Return
a PropertyGetter for the aggregate name, or null if the property is not annotated
Parameters
T
the type of the object containing the property
See also
Throws
if the annotated property is not of type String