Ejemplo n.º 1
0
 public static TypeAdapter on(Fixture fixture, Method method, boolean isRegex) {
   TypeAdapter a = on(fixture, method.getReturnType());
   a.target = fixture;
   a.method = method;
   a.isRegex = isRegex;
   return a;
 }
Ejemplo n.º 2
0
 protected Map<Object, Object> cSort(List<?> list, int col) {
   TypeAdapter a = columnBindings[col].adapter;
   Map<Object, Object> result = new ConcurrentHashMap<Object, Object>(list.size());
   for (Object row : list) {
     try {
       a.target = row;
       Object key = a.get();
       bin(result, key, row);
     } catch (Exception e) {
       // surplus anything with bad keys, including null
       surplus.add(row);
     }
   }
   return result;
 }
Ejemplo n.º 3
0
 protected void check(List<?> eList, List<?> cList) {
   if (eList.isEmpty()) {
     surplus.addAll(cList);
     return;
   }
   if (cList.isEmpty()) {
     missing.addAll(eList);
     return;
   }
   Parse row = (Parse) eList.remove(0);
   Parse cell = row.parts;
   Object obj = cList.remove(0);
   for (int i = 0; i < columnBindings.length && cell != null; i++) {
     TypeAdapter a = columnBindings[i].adapter;
     if (a != null) {
       a.target = obj;
     }
     check(cell, a);
     cell = cell.more;
   }
   check(eList, cList);
 }
Ejemplo n.º 4
0
 protected Parse buildCells(Object row) {
   if (row == null) {
     Parse nil = new Parse("td", "null", null, null);
     nil.addToTag(" colspan=" + columnBindings.length);
     return nil;
   }
   Parse root = new Parse(null, null, null, null);
   Parse next = root;
   for (Binding columnBinding : columnBindings) {
     next = next.more = new Parse("td", "&nbsp;", null, null);
     TypeAdapter a = columnBinding.adapter;
     if (a == null) {
       ignore(next);
     } else {
       try {
         a.target = row;
         next.body = gray(escape(a.toString(a.get())));
       } catch (Exception e) {
         exception(next, e);
       }
     }
   }
   return root.more;
 }
Ejemplo n.º 5
0
 public static TypeAdapter on(Fixture fixture, Field field) {
   TypeAdapter a = on(fixture, field.getType());
   a.target = fixture;
   a.field = field;
   return a;
 }