Class PercentileAllocation

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

public class PercentileAllocation extends Object
Percentile allocation of a variant for feature flag targeting. This class defines how users are assigned to a specific variant based on a percentage range. It allows for gradual rollout of features to a specific percentage of users by defining a variant name and a numeric range (from-to) that determines which portion of users receive this variant when the feature is evaluated.
  • Constructor Details

    • PercentileAllocation

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

    • getVariant

      public String getVariant()
      Gets the name of the variant that is assigned to users within the specified percentage range.
      Returns:
      the variant name for this percentile allocation
    • setVariant

      public PercentileAllocation setVariant(String variant)
      Sets the name of the variant that should be assigned to users within the specified percentage range. This should match a valid variant name defined in the feature flag configuration.
      Parameters:
      variant - the variant name to assign for this percentile range
      Returns:
      the updated PercentileAllocation instance for method chaining
    • getFrom

      public Double getFrom()
      Gets the lower bound of the percentage range for this variant allocation. This represents the starting point of the percentile range where users will be assigned to this variant. The value is inclusive and typically between 0.0 and 100.0.
      Returns:
      the lower bound percentage value for this allocation
    • setFrom

      public PercentileAllocation setFrom(Double from)
      Sets the lower bound of the percentage range for this variant allocation. This value is inclusive (users with computed hash values greater than or equal to this value will be assigned to this variant). The value should be between 0.0 and 100.0 and less than the 'to' value.
      Parameters:
      from - the lower bound percentage value to set for this allocation
      Returns:
      the updated PercentileAllocation instance for method chaining
    • getTo

      public Double getTo()
      Gets the upper bound of the percentage range for this variant allocation.

      This value is exclusive (users with computed hash values strictly less than this value will be assigned to this variant), except when set to 100, where it becomes inclusive. The value should be between 0.0 and 100.0 and greater than the 'from' value.

      Returns:
      the upper bound percentage value for this allocation
    • setTo

      public PercentileAllocation setTo(Double to)
      Sets the upper bound of the percentage range for this variant allocation.

      This value is exclusive (users with computed hash values strictly less than this value will be assigned to this variant), except when set to 100, where it becomes inclusive. The value should be between 0.0 and 100.0 and greater than the 'from' value.

      Parameters:
      to - the upper bound percentage value to set for this allocation
      Returns:
      the updated PercentileAllocation instance for method chaining