NIHVIVO-202 Modify validation of frontend vitro namespace property edits to allow both the validator "nonempty" and a range datatype validator.

This commit is contained in:
rjy7 2010-03-19 19:47:38 +00:00
parent 1081648126
commit ea25ff4ffb
4 changed files with 142 additions and 13 deletions

View file

@ -1,9 +1,45 @@
/* $This file is distributed under the terms of the license in /doc/license.txt$ */
package edu.cornell.mannlib.vitro.webapp.utils;
import java.util.List;
public class StringUtils {
public static String capitalize(String s) {
return s.substring(0, 1).toUpperCase() + s.substring(1);
}
public static String quote(String s) {
return s.isEmpty() ? "" : '"' + s + '"';
}
public static String join(List<?> list, boolean quote, String glue) {
if (glue == null) {
glue = ",";
}
String joinedList = "";
int count = 0;
for (Object o : list) {
String s = o.toString();
if (count > 0) {
joinedList += glue;
}
count++;
joinedList += quote ? quote(s) : s;
}
return joinedList;
}
public static String join(List<?> list) {
return join(list, false, ",");
}
public static String quotedList(List<?> list, String glue) {
return join(list, true, glue);
}
}