-
Notifications
You must be signed in to change notification settings - Fork 70
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 (#218)
* feat: Handle dependent feature toggles
- Loading branch information
Christopher Kolstad
authored
Oct 12, 2023
1 parent
def11ea
commit f74e252
Showing
8 changed files
with
343 additions
and
38 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
Oops, something went wrong.