-
Notifications
You must be signed in to change notification settings - Fork 68
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Add support for fallback-action #93
Changes from 1 commit
a4b2c44
548b9b7
63b1621
d6057c5
b731dba
e96a173
b4c8712
2e8bfcc
2b7ac49
5dc0061
e0eb435
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
package no.finn.unleash; | ||
|
||
public interface FallbackAction { | ||
void apply(String toggleName, UnleashContext unleashContext); | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,6 +15,10 @@ default boolean isEnabled(String toggleName, UnleashContext context, boolean def | |
return isEnabled(toggleName, defaultSetting); | ||
} | ||
|
||
boolean isEnabled(final String toggleName, boolean defaultSetting, final FallbackAction fallbackAction); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Instead of defining a new interface we could actually use one of the functional interfaces: There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oh yeah, completely forgot about these, I will change that accordingly. |
||
|
||
boolean isEnabled(final String toggleName, final FallbackAction fallbackAction); | ||
|
||
Variant getVariant(final String toggleName, final UnleashContext context); | ||
|
||
Variant getVariant(final String toggleName, final UnleashContext context, final Variant defaultValue); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would rather invert it and have this function being the master and have the other
isEnabled
calls send in a proper fallback-action.