}
/**
- * Namepace implementation, that defaults booleans to false and converts camel case keys to dashed strings
+ * Namespace implementation, that has plural handling for list arguments and converts camel case keys to dashed strings
*/
final class JsonRpcNamespace extends Namespace {
super(attrs);
}
+ @Override
public <T> T get(String dest) {
final T value = super.get(dest);
if (value != null) {
@Override
public <E> List<E> getList(final String dest) {
- final List<E> value = super.getList(dest);
- if (value != null) {
- return value;
+ try {
+ final List<E> value = super.getList(dest);
+ if (value != null) {
+ return value;
+ }
+ } catch (ClassCastException e) {
+ return List.of(this.<E>get(dest));
}
return super.getList(dest + "s");
}
-
- @Override
- public Boolean getBoolean(String dest) {
- Boolean maybeGotten = this.get(dest);
- if (maybeGotten == null) {
- maybeGotten = false;
- }
- return maybeGotten;
- }
}
}