diff --git a/sdk/spring/spring-cloud-azure-feature-management/src/main/java/com/azure/spring/cloud/feature/management/models/Allocation.java b/sdk/spring/spring-cloud-azure-feature-management/src/main/java/com/azure/spring/cloud/feature/management/models/Allocation.java index 6d428fe38682..ca2add71313b 100644 --- a/sdk/spring/spring-cloud-azure-feature-management/src/main/java/com/azure/spring/cloud/feature/management/models/Allocation.java +++ b/sdk/spring/spring-cloud-azure-feature-management/src/main/java/com/azure/spring/cloud/feature/management/models/Allocation.java @@ -14,6 +14,12 @@ @JsonIgnoreProperties(ignoreUnknown = true) public class Allocation { + /** + * Creates a new instance of the Allocation class. + */ + public Allocation() { + } + @JsonProperty("default_when_enabled") private String defaultWhenEnabled; @@ -29,15 +35,19 @@ public class Allocation { private String seed; /** - * @return the defaultWhenEnabled + * Gets the variant to use when the feature flag is enabled and no specific allocation matches. + * + * @return the default variant when the feature flag is enabled */ public String getDefaultWhenEnabled() { return defaultWhenEnabled; } /** - * @param defaultWhenEnabled the defaultWhenEnabled to set - * @return Allocation + * Sets the variant to use when the feature flag is enabled and no specific allocation matches. + * + * @param defaultWhenEnabled the default variant when enabled + * @return the updated Allocation object */ public Allocation setDefaultWhenEnabled(String defaultWhenEnabled) { this.defaultWhenEnabled = defaultWhenEnabled; @@ -45,15 +55,19 @@ public Allocation setDefaultWhenEnabled(String defaultWhenEnabled) { } /** - * @return the defaultWhenDisabled + * Gets the variant to use when the feature flag is disabled and no specific allocation matches. + * + * @return the default variant when the feature flag is disabled */ public String getDefaultWhenDisabled() { return defaultWhenDisabled; } /** - * @param defaultWhenDisabled the defaultWhenDisabled to set - * @return Allocation + * Sets the variant to use when the feature flag is disabled and no specific allocation matches. + * + * @param defaultWhenDisabled the default variant when disabled + * @return the updated Allocation object */ public Allocation setDefaultWhenDisabled(String defaultWhenDisabled) { this.defaultWhenDisabled = defaultWhenDisabled; @@ -61,15 +75,19 @@ public Allocation setDefaultWhenDisabled(String defaultWhenDisabled) { } /** - * @return the users + * Gets the list of user-specific allocations for the feature flag. + * + * @return the list of user allocations */ public List getUser() { return user; } /** - * @param user the users to set - * @return Allocation + * Sets the list of user-specific allocations for the feature flag. + * + * @param user the list of user allocations + * @return the updated Allocation object */ public Allocation setUser(List user) { this.user = user; @@ -77,15 +95,19 @@ public Allocation setUser(List user) { } /** - * @return the groups + * Gets the list of group-specific allocations for the feature flag. + * + * @return the list of group allocations */ public List getGroup() { return group; } /** - * @param group the groups to set - * @return Allocation + * Sets the list of group-specific allocations for the feature flag. + * + * @param group the list of group allocations + * @return the updated Allocation object */ public Allocation setGroups(List group) { this.group = group; @@ -93,15 +115,19 @@ public Allocation setGroups(List group) { } /** - * @return the percentile + * Gets the list of percentile-based allocations for the feature flag. + * + * @return the list of percentile allocations */ public List getPercentile() { return percentile; } /** - * @param percentile the percentile to set - * @return Allocation + * Sets the list of percentile-based allocations for the feature flag. + * + * @param percentile the list of percentile allocations + * @return the updated Allocation object */ public Allocation setPercentile(List percentile) { this.percentile = percentile; @@ -109,15 +135,19 @@ public Allocation setPercentile(List percentile) { } /** - * @return the seed + * Gets the seed value used for randomization in allocation calculations. + * + * @return the seed value for allocation */ public String getSeed() { return seed; } /** - * @param seed the seed to set - * @return Allocation + * Sets the seed value used for randomization in allocation calculations. + * + * @param seed the seed value for allocation + * @return the updated Allocation object */ public Allocation setSeed(String seed) { this.seed = seed; diff --git a/sdk/spring/spring-cloud-azure-feature-management/src/main/java/com/azure/spring/cloud/feature/management/models/Conditions.java b/sdk/spring/spring-cloud-azure-feature-management/src/main/java/com/azure/spring/cloud/feature/management/models/Conditions.java index 069c6bbafab7..8ec90d82c05b 100644 --- a/sdk/spring/spring-cloud-azure-feature-management/src/main/java/com/azure/spring/cloud/feature/management/models/Conditions.java +++ b/sdk/spring/spring-cloud-azure-feature-management/src/main/java/com/azure/spring/cloud/feature/management/models/Conditions.java @@ -12,26 +12,55 @@ import com.fasterxml.jackson.annotation.JsonProperty; /** - * Conditions for evaluating a feature flag. +* Conditions for evaluating a feature flag. This class defines how feature filters +* should be evaluated to determine if a feature flag is enabled for the current request. +* It specifies both the filters to check and how their results should be combined +* (e.g., if all filters must pass or if only one needs to pass). */ @JsonIgnoreProperties(ignoreUnknown = true) public class Conditions { + + /** + * Creates a new instance of the Conditions class. + */ + public Conditions() { + } + + /** + * List of client-side feature filters to evaluate for determining if + * a feature flag is enabled. Each filter context contains parameters + * needed for filter evaluation. + */ @JsonProperty("client_filters") private List clientFilters = new ArrayList<>(); + /** + * Requirement type that determines the logic for combining filter results. + * Default is typically "All" which means all filters must pass for the + * feature to be enabled (logical AND). + */ @JsonProperty("requirement_type") private String requirementType = DEFAULT_REQUIREMENT_TYPE; /** - * @return the requirementType + * Gets the requirement type that determines how feature filters are evaluated. + * The requirement type specifies whether all filters must evaluate to true (AND logic) + * or if only one filter needs to evaluate to true (OR logic). + * + * @return the requirement type for filter evaluation */ public String getRequirementType() { return requirementType; } /** - * @param requirementType the requirementType to set - * @return Conditions + * Sets the requirement type that determines how feature filters are evaluated. + * Valid values are typically "All" (AND logic) or "Any" (OR logic), + * where "All" requires all filters to evaluate to true, and "Any" requires + * only one filter to evaluate to true. + * + * @param requirementType the requirement type to set for filter evaluation + * @return the updated Conditions object */ public Conditions setRequirementType(String requirementType) { this.requirementType = requirementType; @@ -39,15 +68,23 @@ public Conditions setRequirementType(String requirementType) { } /** - * @return the clientFilters + * Gets the list of client-side feature filters that should be evaluated + * to determine if a feature flag is enabled. + * Each filter contains its own parameters and evaluation context. + * + * @return the list of client-side feature filters */ public List getClientFilters() { return clientFilters; } /** - * @param clientFilters the clientFilters to set - * @return Conditions + * Sets the list of client-side feature filters to be evaluated + * to determine if a feature flag is enabled. + * Each filter should contain its necessary parameters and context for evaluation. + * + * @param clientFilters the list of client-side feature filters to set + * @return the updated Conditions object */ public Conditions setClientFilters(List clientFilters) { this.clientFilters = clientFilters; diff --git a/sdk/spring/spring-cloud-azure-feature-management/src/main/java/com/azure/spring/cloud/feature/management/models/EvaluationEvent.java b/sdk/spring/spring-cloud-azure-feature-management/src/main/java/com/azure/spring/cloud/feature/management/models/EvaluationEvent.java index 446a5d5aa911..e6a6596ed2ba 100644 --- a/sdk/spring/spring-cloud-azure-feature-management/src/main/java/com/azure/spring/cloud/feature/management/models/EvaluationEvent.java +++ b/sdk/spring/spring-cloud-azure-feature-management/src/main/java/com/azure/spring/cloud/feature/management/models/EvaluationEvent.java @@ -3,45 +3,79 @@ package com.azure.spring.cloud.feature.management.models; /** - * Event tracking the evaluation of a feature flag + * Event tracking the evaluation of a feature flag. This class captures information about + * a feature flag evaluation, including which user evaluated it, whether it was enabled, + * which variant was returned (if any), and the reason for the variant assignment. */ public class EvaluationEvent { + /** + * The feature flag that was evaluated. This contains information such as the + * feature flag name, its conditions, and other associated metadata. + */ private final Feature feature; + /** + * The identifier for the user who evaluated the feature flag. + * This is used for user-targeting scenarios and analytics. + */ private String user = ""; + /** + * Indicates whether the feature flag was determined to be enabled + * for this particular evaluation. + */ private boolean enabled = false; + /** + * The variant that was assigned during this feature flag evaluation. + * This is used for feature flags that support multiple variants beyond + * simply enabled or disabled. + */ private Variant variant; + /** + * The reason why a particular variant was assigned during the evaluation. + * This helps track the decision-making process that led to the variant selection. + */ private VariantAssignmentReason reason = VariantAssignmentReason.NONE; /** - * Creates an Evaluation Event for the given feature - * @param feature Feature + * Creates an Evaluation Event for the given feature. + * This constructor initializes a new evaluation event with the specified feature flag, + * while setting default values for other properties. + * + * @param feature The feature flag that is being evaluated */ public EvaluationEvent(Feature feature) { this.feature = feature; } /** - * @return the feature + * Gets the feature flag that was evaluated. + * + * @return the feature flag associated with this evaluation event */ public Feature getFeature() { return feature; } /** - * @return the user + * Gets the identifier of the user who evaluated the feature flag. + * This is useful for targeting specific users with features and for analytics tracking. + * + * @return the user identifier associated with this evaluation */ public String getUser() { return user; } /** - * @param user the user to set - * @return EvaluationEvent + * Sets the identifier of the user who evaluated the feature flag. + * This allows tracking which user accessed a particular feature. + * + * @param user the user identifier to associate with this evaluation + * @return the updated EvaluationEvent instance for method chaining */ public EvaluationEvent setUser(String user) { this.user = user; @@ -49,15 +83,21 @@ public EvaluationEvent setUser(String user) { } /** - * @return the enabled + * Determines whether the feature flag was enabled for this evaluation. + * This indicates the result of the evaluation process for the feature flag. + * + * @return true if the feature flag was enabled, false otherwise */ public boolean isEnabled() { return enabled; } /** - * @param enabled the enabled to set - * @return EvaluationEvent + * Sets whether the feature flag was enabled for this evaluation. + * This allows recording the result of the feature flag evaluation process. + * + * @param enabled true to mark the feature as enabled, false otherwise + * @return the updated EvaluationEvent instance for method chaining */ public EvaluationEvent setEnabled(boolean enabled) { this.enabled = enabled; @@ -65,15 +105,23 @@ public EvaluationEvent setEnabled(boolean enabled) { } /** - * @return the variant + * Gets the variant that was assigned during this feature flag evaluation. + * This is relevant for feature flags that support multiple variants + * rather than just being enabled or disabled. + * + * @return the variant assigned for this evaluation, or null if no variant was assigned */ public Variant getVariant() { return variant; } /** - * @param variant the variant to set - * @return EvaluationEvent + * Sets the variant that was assigned during this feature flag evaluation. + * This allows recording which specific variant of a feature flag was selected + * when multiple variants are supported. + * + * @param variant the variant to associate with this evaluation + * @return the updated EvaluationEvent instance for method chaining */ public EvaluationEvent setVariant(Variant variant) { this.variant = variant; @@ -81,15 +129,23 @@ public EvaluationEvent setVariant(Variant variant) { } /** - * @return the reason + * Gets the reason why a particular variant was assigned during this evaluation. + * This helps track the decision-making process behind the variant selection + * and can be useful for debugging and analytics. + * + * @return the reason for the variant assignment */ public VariantAssignmentReason getReason() { return reason; } /** - * @param reason the reason to set - * @return EvaluationEvent + * Sets the reason why a particular variant was assigned during this evaluation. + * This documents the logic behind why a specific variant was chosen, which + * can be useful for troubleshooting and analytics purposes. + * + * @param reason the reason for the variant assignment + * @return the updated EvaluationEvent instance for method chaining */ public EvaluationEvent setReason(VariantAssignmentReason reason) { this.reason = reason; diff --git a/sdk/spring/spring-cloud-azure-feature-management/src/main/java/com/azure/spring/cloud/feature/management/models/Feature.java b/sdk/spring/spring-cloud-azure-feature-management/src/main/java/com/azure/spring/cloud/feature/management/models/Feature.java index f292fa6e6969..3738806af4c4 100644 --- a/sdk/spring/spring-cloud-azure-feature-management/src/main/java/com/azure/spring/cloud/feature/management/models/Feature.java +++ b/sdk/spring/spring-cloud-azure-feature-management/src/main/java/com/azure/spring/cloud/feature/management/models/Feature.java @@ -4,45 +4,84 @@ package com.azure.spring.cloud.feature.management.models; import java.util.List; + import org.springframework.lang.NonNull; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonProperty; /** - * App Configuration Feature defines the feature name and a Map of FeatureFilterEvaluationContexts. + * 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. */ @JsonIgnoreProperties(ignoreUnknown = true) public class Feature { + + /** + * Creates a new instance of the Feature class. + */ + public Feature() { + } + + /** + * The unique identifier for this feature flag. + * This represents the name of the feature as stored in Azure App Configuration. + */ @JsonProperty("id") private String id; + /** + * A human-readable description of the feature flag and its purpose. + * This provides context about what the feature flag controls. + */ @JsonProperty("description") private String description; + /** + * The enabled state of the feature flag. + * When true, the feature is enabled by default, though conditions may still apply. + * When false, the feature is disabled by default. + */ @JsonProperty("enabled") private boolean enabled; + /** + * The set of conditions that determine when this feature flag should be enabled. + * These conditions contain feature filters and their evaluation logic. + */ @JsonProperty("conditions") @NonNull private Conditions conditions = new Conditions(); + /** + * The allocation strategy for this feature flag when using variants. + * Determines how users or requests are assigned to specific variants. + */ @JsonProperty("allocation") private Allocation allocation; + /** + * The list of variant references that define the different variations + * of this feature flag when it supports multiple implementations. + */ @JsonProperty("variants") private List variants; /** - * @return the id + * Gets the unique identifier of this feature flag. + * + * @return the feature flag's identifier */ public String getId() { return id; } /** - * @param id the id to set - * @return Feature + * Sets the unique identifier of this feature flag. + * + * @param id the feature flag identifier to set + * @return the updated Feature instance for method chaining */ public Feature setId(String id) { this.id = id; @@ -50,15 +89,20 @@ public Feature setId(String id) { } /** - * @return the enabled + * Determines whether this feature flag is enabled by default. + * Even when enabled, the flag may still be controlled by conditions and filters. + * + * @return true if the feature flag is enabled, false otherwise */ public boolean isEnabled() { return enabled; } /** - * @param enabled the enabled to set - * @return Feature + * Sets whether this feature flag is enabled by default. + * + * @param enabled true to enable the feature flag, false to disable it + * @return the updated Feature instance for method chaining */ public Feature setEnabled(boolean enabled) { this.enabled = enabled; @@ -66,15 +110,20 @@ public Feature setEnabled(boolean enabled) { } /** - * @return the description + * Gets the human-readable description of this feature flag. + * + * @return the description of the feature flag */ public String getDescription() { return description; } /** - * @param description the description to set - * @return Feature + * Sets the human-readable description of this feature flag. + * This provides context about what the feature flag controls. + * + * @param description the description to set for the feature flag + * @return the updated Feature instance for method chaining */ public Feature setDescription(String description) { this.description = description; @@ -82,15 +131,22 @@ public Feature setDescription(String description) { } /** - * @return the conditions + * Gets the set of conditions that determine when this feature flag should be enabled. + * The conditions contain feature filters and their evaluation logic. + * + * @return the conditions for feature flag evaluation */ public Conditions getConditions() { return conditions; } /** - * @param conditions the conditions to set - * @return Feature + * 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. + * + * @param conditions the conditions to set for feature flag evaluation + * @return the updated Feature instance for method chaining */ public Feature setConditions(Conditions conditions) { this.conditions = conditions; @@ -98,15 +154,23 @@ public Feature setConditions(Conditions conditions) { } /** - * @return the allocation + * 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. + * + * @return the allocation strategy for variant assignment */ public Allocation getAllocation() { return allocation; } /** - * @param allocation the allocation to set - * @return Feature + * 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. + * + * @param allocation the allocation strategy to set for variant assignment + * @return the updated Feature instance for method chaining */ public Feature setAllocation(Allocation allocation) { this.allocation = allocation; @@ -114,15 +178,23 @@ public Feature setAllocation(Allocation allocation) { } /** - * @return the variants + * 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. + * + * @return the list of variant references for this feature flag */ public List getVariants() { return variants; } /** - * @param variants the variants to set - * @return Feature + * 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. + * + * @param variants the list of variant references to set for this feature flag + * @return the updated Feature instance for method chaining */ public Feature setVariants(List variants) { this.variants = variants; diff --git a/sdk/spring/spring-cloud-azure-feature-management/src/main/java/com/azure/spring/cloud/feature/management/models/GroupAllocation.java b/sdk/spring/spring-cloud-azure-feature-management/src/main/java/com/azure/spring/cloud/feature/management/models/GroupAllocation.java index 36c2f845322a..221faf3ce65c 100644 --- a/sdk/spring/spring-cloud-azure-feature-management/src/main/java/com/azure/spring/cloud/feature/management/models/GroupAllocation.java +++ b/sdk/spring/spring-cloud-azure-feature-management/src/main/java/com/azure/spring/cloud/feature/management/models/GroupAllocation.java @@ -5,37 +5,68 @@ import java.util.List; /** - * Group allocation of a variant. Contains a variant and a list of groups assigned to the variant. + * Group allocation of a variant for feature flag targeting. This class defines how specific + * user groups are assigned to a particular variant of a feature. It contains a reference + * to a variant name and a list of group identifiers that should receive this variant + * when the feature flag is evaluated. */ public class GroupAllocation { + /** + * Creates a new instance of the GroupAllocation class. + */ + public GroupAllocation() { + } + + /** + * The name of the variant that will be assigned to the specified groups. + * This corresponds to a variant defined in the feature flag configuration. + */ private String variant; + /** + * The list of group identifiers that should receive this variant. + * When a user belongs to any of these groups, they will be assigned + * this variant during feature flag evaluation. + */ private List groups; /** - * @return the variant + * Gets the name of the variant that is assigned to the specified groups. + * + * @return the variant name for this group allocation */ public String getVariant() { return variant; } /** - * @param variant the variant to set + * Sets the name of the variant that should be assigned to the specified groups. + * This should match a valid variant name defined in the feature flag configuration. + * + * @param variant the variant name to assign to the groups */ public void setVariant(String variant) { this.variant = variant; } /** - * @return the groups + * Gets the list of group identifiers that should receive this variant. + * When a user belongs to any of these groups, they will be assigned + * this variant during feature flag evaluation. + * + * @return the list of group identifiers for this allocation */ public List getGroups() { return groups; } /** - * @param groups the groups to set + * Sets the list of group identifiers that should receive this variant. + * When a user belongs to any of these groups, they will be assigned + * this variant during feature flag evaluation. + * + * @param groups the list of group identifiers to associate with this variant */ public void setGroups(List groups) { this.groups = groups; diff --git a/sdk/spring/spring-cloud-azure-feature-management/src/main/java/com/azure/spring/cloud/feature/management/models/PercentileAllocation.java b/sdk/spring/spring-cloud-azure-feature-management/src/main/java/com/azure/spring/cloud/feature/management/models/PercentileAllocation.java index dde6abbffe02..38400bef0256 100644 --- a/sdk/spring/spring-cloud-azure-feature-management/src/main/java/com/azure/spring/cloud/feature/management/models/PercentileAllocation.java +++ b/sdk/spring/spring-cloud-azure-feature-management/src/main/java/com/azure/spring/cloud/feature/management/models/PercentileAllocation.java @@ -5,54 +5,108 @@ import com.fasterxml.jackson.annotation.JsonIgnoreProperties; /** - * Percentile allocation of a variant. Contains a variant and a range of users assigned to the variant. + * 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. */ @JsonIgnoreProperties(ignoreUnknown = true) public class PercentileAllocation { + /** + * Creates a new instance of the PercentileAllocation class. + */ + public PercentileAllocation() { + } + + /** + * The name of the variant that will be assigned to users within the specified + * percentage range. This corresponds to a variant defined in the feature flag + * configuration. + */ private String variant; + /** + * The lower bound (inclusive) of the percentage range for this variant allocation. + * Users with a computed hash value >= this percentage will be assigned to this + * variant. The value should be between 0.0 and 100.0. + */ private Double from; + /** + * 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. + *

+ */ private Double to; /** - * @return the variant + * Gets the name of the variant that is assigned to users within the specified + * percentage range. + * + * @return the variant name for this percentile allocation */ public String getVariant() { return variant; } /** - * @param variant the variant to set + * 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. + * + * @param variant the variant name to assign for this percentile range */ public void setVariant(String variant) { this.variant = variant; - } - - /** - * @return the from + } /** + * 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. + * + * @return the lower bound percentage value for this allocation */ public Double getFrom() { return from; } /** - * @param from the from to set + * 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. + * + * @param from the lower bound percentage value to set for this allocation */ public void setFrom(Double from) { this.from = from; - } - - /** - * @return the to + } /** + * 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. + *

+ * + * @return the upper bound percentage value for this allocation */ public Double getTo() { return to; } /** - * @param to the to to set + * 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. + *

+ * + * @param to the upper bound percentage value to set for this allocation */ public void setTo(Double to) { this.to = to; diff --git a/sdk/spring/spring-cloud-azure-feature-management/src/main/java/com/azure/spring/cloud/feature/management/models/UserAllocation.java b/sdk/spring/spring-cloud-azure-feature-management/src/main/java/com/azure/spring/cloud/feature/management/models/UserAllocation.java index c63d9261fd62..cbd87308cca8 100644 --- a/sdk/spring/spring-cloud-azure-feature-management/src/main/java/com/azure/spring/cloud/feature/management/models/UserAllocation.java +++ b/sdk/spring/spring-cloud-azure-feature-management/src/main/java/com/azure/spring/cloud/feature/management/models/UserAllocation.java @@ -5,37 +5,68 @@ import java.util.List; /** - * User allocation of a variant. Contains a variant and a list of users assigned to the variant. + * User allocation of a variant for feature flag targeting. This class defines how specific + * users are assigned to a particular variant of a feature. It contains a reference to + * a variant name and a list of user identifiers that should receive this variant + * when the feature flag is evaluated. This enables targeted feature rollout to specific users. */ public class UserAllocation { + /** + * Creates a new instance of the UserAllocation class. + */ + public UserAllocation() { + } + + /** + * The name of the variant that will be assigned to the specified users. + * This corresponds to a variant defined in the feature flag configuration. + */ private String variant; + /** + * The list of user identifiers that should receive this variant. + * When a user matches any of these identifiers, they will be assigned + * this variant during feature flag evaluation. + */ private List users; /** - * @return the variant + * Gets the name of the variant that is assigned to the specified users. + * + * @return the variant name for this user allocation */ public String getVariant() { return variant; } /** - * @param variant the variant to set + * Sets the name of the variant that should be assigned to the specified users. + * This should match a valid variant name defined in the feature flag configuration. + * + * @param variant the variant name to assign to the users */ public void setVariant(String variant) { this.variant = variant; } /** - * @return the users + * Gets the list of user identifiers that should receive this variant. + * These identifiers are typically usernames, email addresses, or user IDs + * that uniquely identify users in the system. + * + * @return the list of user identifiers for this allocation */ public List getUsers() { return users; } /** - * @param users the users to set + * Sets the list of user identifiers that should receive this variant. + * When a user matches any of these identifiers, they will be assigned + * this variant during feature flag evaluation. + * + * @param users the list of user identifiers to associate with this variant */ public void setUsers(List users) { this.users = users; diff --git a/sdk/spring/spring-cloud-azure-feature-management/src/main/java/com/azure/spring/cloud/feature/management/models/Variant.java b/sdk/spring/spring-cloud-azure-feature-management/src/main/java/com/azure/spring/cloud/feature/management/models/Variant.java index f811e69ad7c4..ade2c831cfbb 100644 --- a/sdk/spring/spring-cloud-azure-feature-management/src/main/java/com/azure/spring/cloud/feature/management/models/Variant.java +++ b/sdk/spring/spring-cloud-azure-feature-management/src/main/java/com/azure/spring/cloud/feature/management/models/Variant.java @@ -3,18 +3,30 @@ package com.azure.spring.cloud.feature.management.models; /** - * The return object of getVariant that has the name of the variant and the instance value of the variant. + * Represents a feature flag variant in Azure Feature Management. + * This class is the return object of the getVariant method and contains both + * the name of the variant and its corresponding value instance. Variants allow + * for multiple implementations of a feature beyond simple on/off states. */ public class Variant { + /** + * The name of the variant that identifies this specific variation of the feature. + * This is used to match against variant references in feature flag configurations. + */ private String name; + /** + * The actual implementation value of the variant. This can be any type of object + * that represents the variant's behavior or configuration. + */ private Object value; /** - * Variant - * @param name Name of the Variant - * @param value Instance of the Variant + * Creates a new Variant with the specified name and value. + * + * @param name The name that identifies this variant in feature flag configurations + * @param value The implementation value or configuration for this variant */ public Variant(String name, Object value) { this.name = name; @@ -22,28 +34,37 @@ public Variant(String name, Object value) { } /** - * @return the name + * Gets the name of this variant. + * + * @return the name that identifies this variant */ public String getName() { return name; } /** - * @param name the name to set + * Sets the name of this variant. + * + * @param name the name to identify this variant */ public void setName(String name) { this.name = name; } /** - * @return the value + * Gets the implementation value of this variant. + * This can be any object that represents the variant's behavior or configuration. + * + * @return the implementation value for this variant */ public Object getValue() { return value; } /** - * @param value the value to set + * Sets the implementation value of this variant. + * + * @param value the implementation value to set for this variant */ public void setValue(Object value) { this.value = value; diff --git a/sdk/spring/spring-cloud-azure-feature-management/src/main/java/com/azure/spring/cloud/feature/management/models/VariantAssignmentReason.java b/sdk/spring/spring-cloud-azure-feature-management/src/main/java/com/azure/spring/cloud/feature/management/models/VariantAssignmentReason.java index 334d402ccc03..4d1abbc64280 100644 --- a/sdk/spring/spring-cloud-azure-feature-management/src/main/java/com/azure/spring/cloud/feature/management/models/VariantAssignmentReason.java +++ b/sdk/spring/spring-cloud-azure-feature-management/src/main/java/com/azure/spring/cloud/feature/management/models/VariantAssignmentReason.java @@ -5,30 +5,53 @@ /** * The reason why a given boolean/variant was returned when calling isEnabled/getVariant. + * This enum represents the different filtering mechanisms that determined the feature flag state. */ public enum VariantAssignmentReason { - /** None */ + /** + * Indicates no specific reason was assigned for the feature flag evaluation. + */ NONE("None"), - /** Default when Disabled */ + + /** + * Indicates the feature flag was evaluated based on the default value when the flag is disabled. + */ DEFAULT_WHEN_DISABLED("DefaultWhenDisabled"), - /** Default when Enabled */ + + /** + * Indicates the feature flag was evaluated based on the default value when the flag is enabled. + */ DEFAULT_WHEN_ENABLED("DefaultWhenEnabled"), - /** User */ + + /** + * Indicates the feature flag was evaluated based on user targeting criteria. + */ USER("User"), - /** Group */ + + /** + * Indicates the feature flag was evaluated based on group targeting criteria. + */ GROUP("Group"), - /** Percentile */ - PERCENTILE("Percentile"); - - private final String type; + + /** + * Indicates the feature flag was evaluated based on percentile targeting criteria. + */ + PERCENTILE("Percentile"); private final String type; + /** + * Creates a new instance of the VariantAssignmentReason enum with the specified type. + * + * @param type The string representation of the variant assignment reason + */ VariantAssignmentReason(final String type) { this.type = type; } /** - * @return the type + * Gets the string representation of this variant assignment reason. + * + * @return the string representation of this variant assignment reason */ public String getType() { return type; diff --git a/sdk/spring/spring-cloud-azure-feature-management/src/main/java/com/azure/spring/cloud/feature/management/models/VariantReference.java b/sdk/spring/spring-cloud-azure-feature-management/src/main/java/com/azure/spring/cloud/feature/management/models/VariantReference.java index 7fe054cfcda8..845f41f16096 100644 --- a/sdk/spring/spring-cloud-azure-feature-management/src/main/java/com/azure/spring/cloud/feature/management/models/VariantReference.java +++ b/sdk/spring/spring-cloud-azure-feature-management/src/main/java/com/azure/spring/cloud/feature/management/models/VariantReference.java @@ -6,26 +6,47 @@ /** * Reference to a Variant containing the Variant name, configuration value, and possible status override. + * This class provides a way to reference variants in feature flag configurations and their associated values. */ @JsonIgnoreProperties(ignoreUnknown = true) public class VariantReference { + /** + * The name of the variant reference. + */ private String name; + /** + * The configuration value associated with this variant reference. + * This can be any type of object depending on the feature configuration. + */ private Object configurationValue; + /** + * The status override that can be used to override the default status of a feature flag. + */ private String statusOverride; - + /** - * @return the name + * Creates a new instance of the VariantReference class. + */ + public VariantReference() { + } + + /** + * Gets the name of this variant reference. + * + * @return the name of the variant reference */ public String getName() { return name; } /** - * @param name the name to set - * @return VariantReference + * Sets the name of this variant reference. + * + * @param name the name to set for this variant reference + * @return the updated VariantReference instance for method chaining */ public VariantReference setName(String name) { this.name = name; @@ -33,31 +54,39 @@ public VariantReference setName(String name) { } /** - * @return the configurationValue + * Gets the configuration value associated with this variant reference. + * + * @return the configuration value of this variant reference */ public Object getConfigurationValue() { return configurationValue; } /** - * @param configurationValue the configurationValue to set - * @return VariantReference + * Sets the configuration value for this variant reference. + * + * @param configurationValue the configuration value to set for this variant reference + * @return the updated VariantReference instance for method chaining */ public VariantReference setConfigurationValue(Object configurationValue) { this.configurationValue = configurationValue; return this; } - + /** - * @return the statusOverride + * Gets the status override associated with this variant reference. + * + * @return the status override of this variant reference */ public String getStatusOverride() { return statusOverride; } /** - * @param statusOverride the statusOverride to set - * @return VariantReference + * Sets the status override for this variant reference. + * + * @param statusOverride the status override to set for this variant reference + * @return the updated VariantReference instance for method chaining */ public VariantReference setStatusOverride(String statusOverride) { this.statusOverride = statusOverride;