예제 #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];
 }