toAggregateVersionGetterIfAnnotated
Creates a property getter for the aggregate version if the property is annotated with @AggregateVersion.
This method scans the property for the @AggregateVersion annotation and, if present, converts the property to an integer getter for accessing the aggregate version.
Example usage:
class VersionedCommand(
@AggregateVersion
val version: Int
)
val command = VersionedCommand(42)
val versionGetter = VersionedCommand::version.toAggregateVersionGetterIfAnnotated()
val version = versionGetter?.get(command) // Returns 42Content copied to clipboard
Return
a PropertyGetter for the aggregate version, 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 Int