mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2025-07-18 18:23:06 +00:00
lowercase matching
This commit is contained in:
parent
5b5622b4a7
commit
263e6d5cca
@ -5,6 +5,8 @@ import com.volmit.iris.util.decree.DecreeParameterHandler;
|
|||||||
import com.volmit.iris.util.decree.exceptions.DecreeParsingException;
|
import com.volmit.iris.util.decree.exceptions.DecreeParsingException;
|
||||||
import com.volmit.iris.util.decree.exceptions.DecreeWhichException;
|
import com.volmit.iris.util.decree.exceptions.DecreeWhichException;
|
||||||
|
|
||||||
|
import java.util.Locale;
|
||||||
|
|
||||||
public class BooleanHandler implements DecreeParameterHandler<Boolean> {
|
public class BooleanHandler implements DecreeParameterHandler<Boolean> {
|
||||||
private static final KList<String> trues = new KList<>(
|
private static final KList<String> trues = new KList<>(
|
||||||
"true",
|
"true",
|
||||||
@ -50,10 +52,10 @@ public class BooleanHandler implements DecreeParameterHandler<Boolean> {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public Boolean parse(String in) throws DecreeParsingException, DecreeWhichException {
|
public Boolean parse(String in) throws DecreeParsingException, DecreeWhichException {
|
||||||
if (trues.contains(in)){
|
if (trues.contains(in.toLowerCase())){
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (falses.contains(in)){
|
if (falses.contains(in.toLowerCase())){
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
throw new DecreeParsingException("Cannot convert \"" + in + "\" to a boolean (" + trues.toString(", ") + " / " + falses.toString(", ") + ")");
|
throw new DecreeParsingException("Cannot convert \"" + in + "\" to a boolean (" + trues.toString(", ") + " / " + falses.toString(", ") + ")");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user