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
Feature Suggestion: Method Level @FeatGate #565
Labels
Comments
A runnable example to demo the idea better: public interface UserService {
String SWITCH_PREFIX = "DeliverGate.";
String CLASS_PREFIX = "com.example.service.UserService.";
default String getFirstName() {
String func = "getFirstName";
String variant = "v2";
String flag = ffClient.getVariant(SWITCH_PREFIX + CLASS_PREFIX + func, variant);
String declared = func + "_" + flag;
try {
Method method = this.getClass().getDeclaredMethod(declared);
method.setAccessible(true);
return (String) method.invoke(this);
} catch (NoSuchMethodException | IllegalAccessException | InvocationTargetException e) {
throw new RuntimeException(e);
}
}
}
@Service
public class UserServiceImpl implements UserService {
private String getFirstName_v1() {
return "albert";
}
private String getFirstName_v2() {
return Utils.upperFirst("albert");
}
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Is your feature request related to a problem? Please describe.
The webapp renders user's firstname and lastname.
The 1st sprint delivers a simple solution rendering plain values from database.
The 2nd sprint requires to format the values.
albert
->Albert
,einstein
->E.
.The format utils comes from another team. We need a
@FeatGate
to switch between new format and old no-format, in case the format utils not work.@FeatGate example from current docs
The example is a
Controller
level switch. But we want multiple fine grained flags to switch each independently. Something like:The Feature Sugguestion
We should decouple the @FeatGate flags from code. The impl of UserService should wraps flags and promise to return final values to Controller.
Feature Suggestion: The Real RFC
We want the variants of impl to share the same name as the interface.
getFirstName
, notgetFirstNameV1
; nov1
,v2
@override
The benefits:
getFirstNameV2
back togetFirstName
;-
in git diff, no+
, no+-
Additional context
I guess dynamic languages like Python / JavaScript have dark magics as
@decorator
to implement that.But I'd like to see a more standard and no magic implement.
I suggest the annotation name to be
@DeliverGate
to imply it's about the dev side of code and deliver. Dev can and should delete the lines after stable deliver and without need to notify business departments.Is this feature something you're interested in working on?
The text was updated successfully, but these errors were encountered: