Udostępnij przez


FeatureDefinition Class

  • java.lang.Object
    • com.azure.spring.cloud.feature.management.models.FeatureDefinition

public class FeatureDefinition

This class represents a complete feature flag definition including its identity, description, enabled state, conditions for evaluation, variant allocation, and variant references for feature flags that support multiple variations.

Constructor Summary

Constructor Description
FeatureDefinition()

Creates a new instance of the Feature class.

Method Summary

Modifier and Type Method and Description
Allocation getAllocation()

Gets the allocation strategy for this feature flag when using variants.

Conditions getConditions()

Gets the set of conditions that determine when this feature flag should be enabled.

String getDescription()

Gets the human-readable description of this feature flag.

String getId()

Gets the unique identifier of this feature flag.

FeatureTelemetry getTelemetry()

Gets the telemetry configuration for this feature flag.

List<VariantReference> getVariants()

Gets the list of variant references that define the different variations of this feature flag.

boolean isEnabled()

Determines whether this feature flag is enabled by default.

FeatureDefinition setAllocation(Allocation allocation)

Sets the allocation strategy for this feature flag when using variants.

FeatureDefinition setConditions(Conditions conditions)

Sets the conditions that determine when this feature flag should be enabled.

FeatureDefinition setDescription(String description)

Sets the human-readable description of this feature flag.

FeatureDefinition setEnabled(boolean enabled)

Sets whether this feature flag is enabled by default.

FeatureDefinition setId(String id)

Sets the unique identifier of this feature flag.

FeatureDefinition setTelemetry(FeatureTelemetry telemetry)

Sets the telemetry configuration for this feature flag.

FeatureDefinition setVariants(List<VariantReference> variants)

Sets the list of variant references that define the different variations of this feature flag.

Methods inherited from java.lang.Object

Constructor Details

FeatureDefinition

public FeatureDefinition()

Creates a new instance of the Feature class.

Method Details

getAllocation

public Allocation getAllocation()

Gets the allocation strategy for this feature flag when using variants. The allocation defines how users or requests are assigned to specific variants through mechanisms like user targeting, percentile rollout, or group assignment.

Returns:

the allocation strategy for variant assignment

getConditions

public Conditions getConditions()

Gets the set of conditions that determine when this feature flag should be enabled. The conditions contain feature filters and their evaluation logic.

Returns:

the conditions for feature flag evaluation

getDescription

public String getDescription()

Gets the human-readable description of this feature flag.

Returns:

the description of the feature flag

getId

public String getId()

Gets the unique identifier of this feature flag.

Returns:

the feature flag's identifier

getTelemetry

public FeatureTelemetry getTelemetry()

Gets the telemetry configuration for this feature flag. The telemetry configuration controls whether events related to this feature flag should be logged and what additional metadata should be included.

Returns:

the telemetry configuration for this feature flag

getVariants

public List<VariantReference> getVariants()

Gets the list of variant references that define the different variations of this feature flag. These variants represent different implementations or configurations that can be assigned to users when the feature is enabled.

Returns:

the list of variant references for this feature flag

isEnabled

public boolean isEnabled()

Determines whether this feature flag is enabled by default. Even when enabled, the flag may still be controlled by conditions and filters.

Returns:

true if the feature flag is enabled, false otherwise

setAllocation

public FeatureDefinition setAllocation(Allocation allocation)

Sets the allocation strategy for this feature flag when using variants. The allocation controls how users or requests are assigned to specific variants through user targeting, percentile rollout, or group assignment.

Parameters:

allocation - the allocation strategy to set for variant assignment

Returns:

the updated Feature instance for method chaining

setConditions

public FeatureDefinition setConditions(Conditions conditions)

Sets the conditions that determine when this feature flag should be enabled. These conditions define the feature filters and logic for evaluating whether the feature should be enabled for a specific request.

Parameters:

conditions - the conditions to set for feature flag evaluation

Returns:

the updated Feature instance for method chaining

setDescription

public FeatureDefinition setDescription(String description)

Sets the human-readable description of this feature flag. This provides context about what the feature flag controls.

Parameters:

description - the description to set for the feature flag

Returns:

the updated Feature instance for method chaining

setEnabled

public FeatureDefinition setEnabled(boolean enabled)

Sets whether this feature flag is enabled by default.

Parameters:

enabled - true to enable the feature flag, false to disable it

Returns:

the updated Feature instance for method chaining

setId

public FeatureDefinition setId(String id)

Sets the unique identifier of this feature flag.

Parameters:

id - the feature flag identifier to set

Returns:

the updated Feature instance for method chaining

setTelemetry

public FeatureDefinition setTelemetry(FeatureTelemetry telemetry)

Sets the telemetry configuration for this feature flag. This controls whether events related to this feature flag should be logged and what additional metadata should be included.

Parameters:

telemetry - the telemetry configuration to set for this feature flag

Returns:

the updated Feature instance for method chaining

setVariants

public FeatureDefinition setVariants(List<VariantReference> variants)

Sets the list of variant references that define the different variations of this feature flag. These variants represent different implementations or configurations that can be dynamically assigned when the feature is enabled.

Parameters:

variants - the list of variant references to set for this feature flag

Returns:

the updated Feature instance for method chaining

Applies to