io.vertx.ext.web.validation.impl.body.FormValueParser Maven / Gradle / Ivy
The newest version!
package io.vertx.ext.web.validation.impl.body;
import io.vertx.core.json.JsonArray;
import io.vertx.ext.web.validation.impl.parser.ValueParser;
import java.util.List;
public class FormValueParser implements ValueParser> {
private boolean expectedArray;
private ValueParser innerValueParser;
public FormValueParser(boolean expectedArray, ValueParser innerValueParser) {
this.expectedArray = expectedArray;
this.innerValueParser = innerValueParser;
}
public Object parse(List values) {
if (expectedArray)
return values.stream().map(innerValueParser::parse).collect(JsonArray::new, JsonArray::add, JsonArray::addAll);
else
return innerValueParser.parse(values.get(0));
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy