public Object invoke(Object proxy, final Method method, final Object[] args) throws Throwable { final Molecule<Object> m = new Molecule<Object>() { public void run() { try { setObj(method.invoke(dao, args)); } catch (IllegalArgumentException e) { throw Lang.wrapThrow(e); } catch (IllegalAccessException e) { throw Lang.wrapThrow(e); } catch (InvocationTargetException e) { throw Lang.wrapThrow(e.getTargetException()); } } }; if (filter != null && tableName != null) { TableName.run( tableName, new Runnable() { public void run() { filter.run(m); } }); return m.getObj(); } if (filter != null) filter.run(m); else TableName.run(tableName, m); return m.getObj(); }
public int updateIgnoreNull(final Object obj) { EntityOperator opt = _optBy(obj); if (null == opt) return 0; opt.addUpdateForIgnoreNull(opt.entity, obj, FieldFilter.get(opt.entity.getType())); opt.exec(); return opt.getUpdateCount(); }
/** * Test表改 * * @param test */ public void update(final Test test) { FieldFilter.create(Test.class, true) .run( new Atom() { public void run() { dao().update(test); } }); }
public <T> T insert(final T obj, FieldFilter filter) { if (filter == null) return insert(obj); filter.run( new Atom() { public void run() { insert(obj); } }); return obj; }
public int update(final Object obj, String regex) { Object first = Lang.first(obj); if (null == first) return 0; if (Strings.isBlank(regex)) return update(obj); Molecule<Integer> m = new Molecule<Integer>() { public void run() { setObj(update(obj)); } }; FieldFilter.create(first.getClass(), regex).run(m); return m.getObj(); }