for (Object object : listValues) { String stringValue = (String) object; if (variable.getAllowedValues() != null && !variable.getAllowedValues().contains(stringValue)) { throw new CatalogException(message + " value '" + value + "' is not an allowed value for " + variable); int numericValue = (int) object; if (variable.getAllowedValues() != null && !variable.getAllowedValues().isEmpty()) { boolean valid = false; for (String range : variable.getAllowedValues()) { String[] split = range.split(":", -1); int min = split[0].isEmpty() ? Integer.MIN_VALUE : Integer.valueOf(split[0]); Double numericValue = (Double) object; if (variable.getAllowedValues() != null && !variable.getAllowedValues().isEmpty()) { boolean valid = false; for (String range : variable.getAllowedValues()) { String[] split = range.split(":", -1); Double min = split[0].isEmpty() ? Double.MIN_VALUE : Double.valueOf(split[0]);
public static void checkVariable(Variable variable) throws CatalogException { List<String> acceptedValues = new LinkedList<>(); if (variable.getAllowedValues() != null) { acceptedValues.addAll(variable.getAllowedValues()); if (!variable.getAllowedValues().isEmpty()) { throw new CatalogException("Variable type boolean can not contain accepted values"); case DOUBLE: { if (!variable.getAllowedValues().isEmpty()) { for (String range : variable.getAllowedValues()) { String[] split = range.split(":", -1); if (split.length != 2) {
ParamUtils.checkParameter(variable.getId(), "variable ID"); ParamUtils.checkObj(variable.getType(), "variable Type"); variable.setAllowedValues(ParamUtils.defaultObject(variable.getAllowedValues(), Collections.emptyList())); variable.setAttributes(ParamUtils.defaultObject(variable.getAttributes(), Collections.emptyMap())); variable.setCategory(ParamUtils.defaultString(variable.getCategory(), ""));