Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -29,95 +35,119 @@ 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;
return this;
}

/**
* @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;
return this;
}

/**
* @return the users
* Gets the list of user-specific allocations for the feature flag.
*
* @return the list of user allocations
*/
public List<UserAllocation> 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<UserAllocation> user) {
this.user = user;
return this;
}

/**
* @return the groups
* Gets the list of group-specific allocations for the feature flag.
*
* @return the list of group allocations
*/
public List<GroupAllocation> 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<GroupAllocation> group) {
this.group = group;
return this;
}

/**
* @return the percentile
* Gets the list of percentile-based allocations for the feature flag.
*
* @return the list of percentile allocations
*/
public List<PercentileAllocation> 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<PercentileAllocation> percentile) {
this.percentile = percentile;
return this;
}

/**
* @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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,42 +12,79 @@
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<FeatureFilterEvaluationContext> 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;
return this;
}

/**
* @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<FeatureFilterEvaluationContext> 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<FeatureFilterEvaluationContext> clientFilters) {
this.clientFilters = clientFilters;
Expand Down
Loading