@Override public Object getValue(Object t, Formatter formatter) { if (t == null) return null; Object obj = null; try { obj = t; for (int i = 0; i < fields.size(); i++) obj = fields.get(i).get(obj); } catch (Exception e) { throw new RuntimeException(e); } return formatter.format(obj); }
@Override public void setValue(Object t, Object value, Formatter formatter) { if (t == null) return; Object obj = null; Field field = null; try { obj = t; int size = fields.size() - 1; if (size > -1) { for (int i = 0; i < size; i++) obj = fields.get(i).get(obj); field = fields.get(fields.size() - 1); } else field = fields.get(0); field.set(obj, formatter.parse(value)); } catch (Exception e) { throw new RuntimeException(e); } }