toStaticTenantIdGetterIfAnnotated

Creates a property getter for the static tenant ID if the class is annotated with @StaticTenantId.

This method scans the class for the @StaticTenantId annotation and, if present, creates a property getter for the specified tenant ID property.

Example usage:

@StaticTenantId(tenantId = "default-tenant")
class DefaultTenantAggregate

val tenantGetter = DefaultTenantAggregate::class.toStaticTenantIdGetterIfAnnotated()
val tenantId = tenantGetter?.get(DefaultTenantAggregate()) // Returns "default-tenant"

Return

a PropertyGetter for the static tenant ID, or null if the class is not annotated

Parameters

T

the type of the class

See also