Fix boolean flags defaulting to false.

This commit is contained in:
boy0001 2015-03-29 17:12:32 +11:00
parent bdcd327d9b
commit bcc366fc3c

View File

@ -48,12 +48,24 @@ public abstract class FlagValue<T> {
@Override
public Boolean parse(final String t) {
try {
return Boolean.parseBoolean(t);
} catch (final IllegalArgumentException e) {
switch (t.toLowerCase()) {
case "1":
case "yes":
case "allow":
case "true": {
return true;
}
case "0":
case "no":
case "deny":
case "false": {
return false;
}
default: {
return null;
}
}
}
@Override
public String getDescription() {