getPropertyValueOrDefault

inline fun <T> Feature.getPropertyValueOrDefault(name: String, default: T): T(source)

Retrieves a custom property's value by name, returning a default if not found.

This is a type-safe convenience method that combines property lookup with null handling. If the property doesn't exist or is of the wrong type, returns the provided default value.

Example:

val maxRetries = feature.getPropertyValueOrDefault("maxRetries", 3)
val timeout = feature.getPropertyValueOrDefault("timeout", 5000L)
val enabled = feature.getPropertyValueOrDefault("cacheEnabled", false)

Return

the property value if found and type matches, otherwise default

Parameters

T

the expected type of the property value (inferred from default)

name

the name of the property to retrieve

default

the value to return if property is not found or type doesn't match


suspend fun <T> PropertyStore.getPropertyValueOrDefault(name: String, default: T): T(source)

Retrieves a property's value, or returns a default if not found.

This is a type-safe convenience method that combines property lookup with null handling. If the property doesn't exist or its value is null, returns the provided default value.

Example:

val maxRetries = store.getPropertyValueOrDefault("maxRetries", 3)
val timeout = store.getPropertyValueOrDefault("timeout", 5000L)
val enabled = store.getPropertyValueOrDefault("cacheEnabled", false)

Return

the property value if found and non-null, otherwise default

Parameters

T

the expected type of the property value (inferred from default)

name

the name of the property to retrieve

default

the value to return if property is not found or value is null