toTenantIdGetterIfAnnotated
Creates a property getter for the tenant ID if the property is annotated with @TenantId.
This method scans the property for the @TenantId annotation and, if present, converts the property to a string getter for accessing the tenant identifier.
Example usage:
class MultiTenantCommand(
@TenantId
val tenantId: String
)
val command = MultiTenantCommand("tenant-456")
val tenantGetter = MultiTenantCommand::tenantId.toTenantIdGetterIfAnnotated()
val tenantId = tenantGetter?.get(command) // Returns "tenant-456"Content copied to clipboard
Return
a PropertyGetter for the tenant ID, 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