Class FeatureDefinition

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

public class FeatureDefinition extends Object
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 Details

    • FeatureDefinition

      public FeatureDefinition()
      Creates a new instance of the Feature class.
  • Method Details

    • getId

      public String getId()
      Gets the unique identifier of this feature flag.
      Returns:
      the feature flag's identifier
    • 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
    • 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
    • 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
    • getDescription

      public String getDescription()
      Gets the human-readable description of this feature flag.
      Returns:
      the description of the feature flag
    • 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
    • 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
    • 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
    • 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
    • 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
    • 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
    • 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
    • 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
    • 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