示例#1
0
 private String toUnderscoreSeparated(String camelCase) {
   String[] array = StringUtils.splitByCharacterTypeCamelCase(camelCase);
   StringBuffer buf = new StringBuffer();
   for (int i = 0; i < array.length; i++) {
     String s = array[i];
     buf.append(s.substring(0, 1).toLowerCase());
     buf.append(s.substring(1));
     if (i != array.length - 1) {
       buf.append("_");
     }
   }
   return buf.toString();
 }
示例#2
0
 private String toString(Map<String, Object> map) {
   StringBuffer buf = new StringBuffer();
   for (String key : map.keySet()) {
     buf.append(key);
     buf.append("=");
     Object value = map.get(key);
     if (value != null) {
       buf.append(value.getClass().getName());
       buf.append(":");
       buf.append(value.toString());
     } else {
       buf.append("null");
     }
     buf.append(", ");
   }
   return buf.toString();
 }
示例#3
0
 private String toCamelCase(String underscoreSeparated) {
   StringTokenizer tokens = new StringTokenizer(underscoreSeparated, "_");
   StringBuffer buf = new StringBuffer();
   while (tokens.hasMoreTokens()) {
     String word = tokens.nextToken();
     if (buf.length() == 0) {
       buf.append(word);
     } else {
       buf.append(word.substring(0, 1).toUpperCase());
       buf.append(word.substring(1));
     }
   }
   return buf.toString();
 }