GFlags uses Validators to quickly resolve any ill-formatted flag value with an application crash and a useful message. The validators are defined similarly to defining a flag and the two stay close together.
Consider following syntax:
private static final Flag<Integer> angle = Flags.integer('angle')
.validate(new Validator<Integer>() {
@Override public boolean check(String flagName, Integer value) {
return value >=0 && value < 360;
}
});
Java 8:
private static final Flag<Integer> angle = Flags.integer('angle')
.validate((flagName, value) -> value >=0 && value < 360);
GFlags uses
Validators to quickly resolve any ill-formatted flag value with an application crash and a useful message. The validators are defined similarly to defining a flag and the two stay close together.Consider following syntax:
Java 8: