-
Notifications
You must be signed in to change notification settings - Fork 71
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Handle dependent feature toggles
- A new feature added in beta to Unleash 5.6. With dependent feature toggle you can configure parent-child relationships. This change makes the SDK evaluate according to the client specifications defined for this.
- Loading branch information
Showing
7 changed files
with
185 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
package io.getunleash; | ||
|
||
import io.getunleash.lang.Nullable; | ||
import java.util.Collections; | ||
import java.util.List; | ||
import javax.annotation.Nonnull; | ||
|
||
public class FeatureDependency { | ||
public String feature; | ||
@Nullable public Boolean enabled; | ||
@Nullable public List<String> variants; | ||
|
||
public FeatureDependency(String feature) { | ||
this.feature = feature; | ||
} | ||
|
||
public FeatureDependency( | ||
String feature, @Nullable Boolean enabled, @Nullable List<String> variants) { | ||
this.feature = feature; | ||
this.enabled = enabled; | ||
this.variants = variants; | ||
} | ||
|
||
public String getFeature() { | ||
return feature; | ||
} | ||
|
||
public void setFeature(String feature) { | ||
this.feature = feature; | ||
} | ||
|
||
public boolean isEnabled() { | ||
return enabled == null || enabled; // Default value here should be true | ||
} | ||
|
||
public void setEnabled(@Nullable Boolean enabled) { | ||
this.enabled = enabled; | ||
} | ||
|
||
@Nonnull | ||
public List<String> getVariants() { | ||
if (variants != null) { | ||
return variants; | ||
} | ||
return Collections.emptyList(); | ||
} | ||
|
||
public void setVariants(@Nullable List<String> variants) { | ||
this.variants = variants; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters