FeatureDefinition Class
- java.
lang. Object - com.
azure. spring. cloud. feature. management. models. FeatureDefinition
- com.
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. |
|
Feature |
getTelemetry()
Gets the telemetry configuration for this feature flag. |
|
List<Variant |
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. |
|
Feature |
setAllocation(Allocation allocation)
Sets the allocation strategy for this feature flag when using variants. |
|
Feature |
setConditions(Conditions conditions)
Sets the conditions that determine when this feature flag should be enabled. |
|
Feature |
setDescription(String description)
Sets the human-readable description of this feature flag. |
|
Feature |
setEnabled(boolean enabled)
Sets whether this feature flag is enabled by default. |
|
Feature |
setId(String id)
Sets the unique identifier of this feature flag. |
|
Feature |
setTelemetry(FeatureTelemetry telemetry)
Sets the telemetry configuration for this feature flag. |
|
Feature |
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:
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:
getDescription
public String getDescription()
Gets the human-readable description of this feature flag.
Returns:
getId
public String getId()
Gets the unique identifier of this feature flag.
Returns:
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:
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:
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:
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:
Returns:
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:
Returns:
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:
Returns:
setEnabled
public FeatureDefinition setEnabled(boolean enabled)
Sets whether this feature flag is enabled by default.
Parameters:
Returns:
setId
public FeatureDefinition setId(String id)
Sets the unique identifier of this feature flag.
Parameters:
Returns:
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:
Returns:
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:
Returns: