JsonFeatureFlag

interface JsonFeatureFlag<T : Any> : FeatureFlag<T>

A JSON feature flag, when evaluated returns T.

It is expected that a Moshi type adapter is registered for T.

Example definition:

// Step 1: Define the object we expect to get from the JSON flag
data class PaymentConfiguration(
val fraudulent: Boolean,
val vipTreatment: Boolean,
val specialDescription: String
)

// Step 2: Define the feature flag
data class PaymentConfigurationFeature(
// Put the `key` and `attributes` here
val customerId: String,
val extraAttribute: String
) : JsonFeatureFlag<PaymentConfiguration> {
override val feature = Feature("payment-configuration-feature")
override val key = customerId
override val attributes = Attributes()
.with("extraAttribute", extraAttribute)
override val returnType = PaymentConfiguration::class
}

Properties

Link copied to clipboard

The attributes of this feature flag, provided during flag evaluation

Link copied to clipboard
abstract val feature: Feature

Feature name of the feature flag

Link copied to clipboard
abstract val key: String

Unique primary key for the entity the flag should be evaluated against.

Link copied to clipboard
abstract val returnType: Class<out T>