net.sf.aguacate.configuration.field.FieldArray Maven / Gradle / Ivy
package net.sf.aguacate.configuration.field;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import net.sf.aguacate.validator.ValidationConversionResult;
/**
*
* "field": {
* "type": "ARRAY",
* "unique": ...,
* "data": {
* "type": "INTEGER"
* "minval": ...,
* "maxval": ...
* }
* }
*
*/
public class FieldArray extends Field {
private final String contextName;
private final Field field;
private final boolean unique;
public FieldArray(String name, boolean optional, String contextName, Field field, boolean unique) {
super(name, Field.ARRAY, optional);
this.contextName = contextName;
this.field = field;
this.unique = unique;
}
@Override
public ValidationConversionResult validateAndConvert(Object value) {
if (value instanceof List) {
@SuppressWarnings("unchecked")
List