PercentileAllocation Class
- java.
lang. Object - com.
azure. spring. cloud. feature. management. models. PercentileAllocation
- com.
public class PercentileAllocation
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 Summary
| Constructor | Description |
|---|---|
| PercentileAllocation() |
Creates a new instance of the Percentile |
Method Summary
| Modifier and Type | Method and Description |
|---|---|
| Double |
getFrom()
Gets the lower bound of the percentage range for this variant allocation. |
| Double |
getTo()
Gets the upper bound of the percentage range for this variant allocation. |
| String |
getVariant()
Gets the name of the variant that is assigned to users within the specified percentage range. |
|
Percentile |
setFrom(Double from)
Sets the lower bound of the percentage range for this variant allocation. |
|
Percentile |
setTo(Double to)
Sets the upper bound of the percentage range for this variant allocation. |
|
Percentile |
setVariant(String variant)
Sets the name of the variant that should be assigned to users within the specified percentage range. |
Methods inherited from java.lang.Object
Constructor Details
PercentileAllocation
public PercentileAllocation()
Creates a new instance of the PercentileAllocation class.
Method Details
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:
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:
getVariant
public String getVariant()
Gets the name of the variant that is assigned to users within the specified percentage range.
Returns:
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:
Returns:
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:
Returns:
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:
Returns: