@Override
 public Object invoke(Object object, Method method, Object[] params) throws Throwable {
   final boolean needUpdate = METHOD_COMMIT.equals(method.getName());
   try {
     Object result = method.invoke(myDelegateModel, unwrapParams(params));
     if (result instanceof Library[]) {
       Library[] libraries = (Library[]) result;
       for (int idx = 0; idx < libraries.length; idx++) {
         Library library = libraries[idx];
         libraries[idx] =
             (Library)
                 Proxy.newProxyInstance(
                     getClass().getClassLoader(),
                     new Class[] {LibraryEx.class},
                     new LibraryInvocationHandler(library));
       }
     }
     if (result instanceof Library) {
       result =
           Proxy.newProxyInstance(
               getClass().getClassLoader(),
               new Class[] {LibraryEx.class},
               new LibraryInvocationHandler((Library) result));
     }
     return result;
   } catch (InvocationTargetException e) {
     throw e.getCause();
   } finally {
     if (needUpdate) {
       updateOrderEntriesInEditors(true);
     }
   }
 }
示例#2
0
 public Object invoke(Object object, Method method, Object[] params) throws Throwable {
   final boolean needUpdate = METHOD_COMMIT.equals(method.getName());
   try {
     return method.invoke(myDelegateModel, unwrapParams(params));
   } catch (InvocationTargetException e) {
     throw e.getCause();
   } finally {
     if (needUpdate) {
       updateOrderEntriesInEditors();
     }
   }
 }