示例#1
0
文件: Daos.java 项目: GaoHuijian/nutz
  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();
  }
示例#2
0
文件: Daos.java 项目: GaoHuijian/nutz
 public static String getTableName(Dao dao, final Entity<?> en, Object t) {
   if (t == null) return en.getTableName();
   final String[] name = new String[1];
   TableName.run(
       t,
       new Runnable() {
         public void run() {
           name[0] = en.getTableName();
         }
       });
   return name[0];
 }