Ejemplo n.º 1
0
 public Object parse(String s) throws Exception {
   StringTokenizer t = new StringTokenizer(s, ",");
   Object array = Array.newInstance(componentType, t.countTokens());
   for (int i = 0; t.hasMoreTokens(); i++) {
     Array.set(array, i, componentAdapter.parse(t.nextToken().trim()));
   }
   return array;
 }
Ejemplo n.º 2
0
 private Object parseCell() {
   try {
     return typeAdapter.isRegex ? cell.text() : typeAdapter.parse(cell.text());
   }
   // Ignore parse exceptions, print non-parse exceptions,
   // return null so that compareCellToResult tries relational matching.
   catch (NumberFormatException e) {
   } catch (ParseException e) {
   } catch (Exception e) {
     e.printStackTrace();
   }
   return new Unparseable();
 }
Ejemplo n.º 3
0
 protected Map<Object, Object> eSort(List<?> list, int col) {
   TypeAdapter a = columnBindings[col].adapter;
   Map<Object, Object> result = new ConcurrentHashMap<Object, Object>(list.size());
   for (Object o : list) {
     Parse row = (Parse) o;
     Parse cell = row.parts.at(col);
     try {
       Object key = a.parse(cell.text());
       bin(result, key, row);
     } catch (Exception e) {
       exception(cell, e);
       for (Parse rest = cell.more; rest != null; rest = rest.more) {
         ignore(rest);
       }
     }
   }
   return result;
 }