static CollectionFormat from(final SerializableParameter parameter) { requireNonNull(parameter, "A parameter is required"); return valueOf(parameter.getCollectionFormat().toUpperCase()); } }
private String getArrayRegex(SerializableParameter param) { String regex; if (param.getCollectionFormat() == null) { regex = Pattern.quote(","); } else { switch (param.getCollectionFormat()) { case "ssv": regex = Pattern.quote(" "); break; case "csv": regex = Pattern.quote(","); break; case "tsv": regex = Pattern.quote("\t"); break; case "pipes": regex = Pattern.quote("|"); break; default: regex = Pattern.quote(","); break; } } return regex; } }
for (String obj : o) { String[] parts = new String[0]; if ("csv".equals(sp.getCollectionFormat()) && !StringUtils.isEmpty(obj)) { parts = obj.split(","); if ("pipes".equals(sp.getCollectionFormat()) && !StringUtils.isEmpty(obj)) { parts = obj.split("|"); if ("ssv".equals(sp.getCollectionFormat()) && !StringUtils.isEmpty(obj)) { parts = obj.split(" "); if ("multi".equals(sp.getCollectionFormat()) && !StringUtils.isEmpty(obj)) { parts = new String[1]; parts[0]= obj;
for (String obj : o) { String[] parts = new String[0]; if ("csv".equals(sp.getCollectionFormat()) && !StringUtils.isEmpty(obj)) { parts = obj.split(","); if ("pipes".equals(sp.getCollectionFormat()) && !StringUtils.isEmpty(obj)) { parts = obj.split("|"); if ("ssv".equals(sp.getCollectionFormat()) && !StringUtils.isEmpty(obj)) { parts = obj.split(" "); if ("multi".equals(sp.getCollectionFormat()) && !StringUtils.isEmpty(obj)) { parts = new String[1]; parts[0]= obj;
public Status validate(final Collection<String> values, final Parameter p) { if (p == null) { return null; } final SerializableParameter parameter = (SerializableParameter)p; if (parameter.getRequired() && (values == null || values.isEmpty())) { return new Status("ERR11001", parameter.getName()); } if (values == null) { return null; } if (!parameter.getCollectionFormat().equalsIgnoreCase(CollectionFormat.MULTI.name())) { return new Status("ERR11005", p.getName(), parameter.getCollectionFormat(), "multi"); } return doValidate(values, parameter); }
String[] parts = new String[0]; CSVFormat format = null; if ("csv".equals(sp.getCollectionFormat()) && !StringUtils.isEmpty(obj)) { format = CSVFormat.DEFAULT; } else if ("pipes".equals(sp.getCollectionFormat()) && !StringUtils.isEmpty(obj)) { format = CSVFormat.newFormat('|').withQuote('"'); } else if ("ssv".equals(sp.getCollectionFormat()) && !StringUtils.isEmpty(obj)) { format = CSVFormat.newFormat(' ').withQuote('"');
String[] parts = new String[0]; CSVFormat format = null; if ("csv".equals(sp.getCollectionFormat()) && !StringUtils.isEmpty(obj)) { format = CSVFormat.DEFAULT; } else if ("pipes".equals(sp.getCollectionFormat()) && !StringUtils.isEmpty(obj)) { format = CSVFormat.newFormat('|').withQuote('"'); } else if ("ssv".equals(sp.getCollectionFormat()) && !StringUtils.isEmpty(obj)) { format = CSVFormat.newFormat(' ').withQuote('"');
String cf = sp.getCollectionFormat();