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; }
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; }
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); }
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", " ", 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; }
public static TypeAdapter on(Fixture fixture, Field field) { TypeAdapter a = on(fixture, field.getType()); a.target = fixture; a.field = field; return a; }