Allow rules to declare they only accept a set of options (#1560)
This commit is contained in:
1 parent
b798d76d10
commit
635fb586c4
3 files changed
+20
-3
No files matched your search
@@ -85,9 +85,9 @@ public final class ParsedRule<T> implements CarpetRule<T>, Comparable<ParsedRule
|
||||
@Deprecated(forRemoval = true) // to private (and rename?)
|
||||
public final List<String> options;
|
||||
/**
|
||||
* @deprecated No replacement for this
|
||||
* @deprecated Use {@link CarpetRule#strict()} instead
|
||||
*/
|
||||
@Deprecated(forRemoval = true) // to pckg private (for printRulesToLog, or get a different way)
|
||||
@Deprecated(forRemoval = true) // to remove or fix
|
||||
public boolean isStrict;
|
||||
/**
|
||||
* @deprecated Use {@link CarpetRule#canBeToggledClientSide()} instead
|
||||
@@ -391,6 +391,11 @@ public final class ParsedRule<T> implements CarpetRule<T>, Comparable<ParsedRule
|
||||
set(source, value, RuleHelper.toRuleString(value));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean strict() {
|
||||
return !realValidators.isEmpty() && realValidators.get(0) instanceof Validator.StrictValidator;
|
||||
}
|
||||
|
||||
private static <T> Map.Entry<Class<T>, FromStringConverter<T>> numericalConverter(Class<T> outputClass, Function<String, T> converter) {
|
||||
return Map.entry(outputClass, str -> {
|
||||
try {
|
||||
|
||||
Reference in new issue
Block a user