Package java.lang.reflect

Examples of java.lang.reflect.InvocationHandler.invoke()


         Proxy proxy = (Proxy) ic.lookup(jndiName);

         // call findByPrimary on the target
         InvocationHandler ih = Proxy.getInvocationHandler(proxy);
         return (EJBObject) ih.invoke(proxy, GET_EJB_OBJECT, new Object[] {id});
      }
      catch (RemoteException e)
      {
         throw e;
      }
View Full Code Here


                 * the call we will end up here again and we'll get a
                 * StackOverflowError.
                 */
                final InvocationHandler invocationHandler = MockRepository.removeMethodProxy(method);
                try {
                    returnValue = invocationHandler.invoke(object, method, args);
                } finally {
                    // Set the method proxy again after the invocation
                    MockRepository.putMethodProxy(method, invocationHandler);
                }

View Full Code Here

        @Override
        public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
            for (InvocationHandlerFactory factory: factories) {
                InvocationHandler handler = factory.tryGetInvocationHandler(proxy, method, args);
                if (handler != null) {
                    return handler.invoke(proxy, method, args);
                }
            }
            throw new UnsupportedOperationException("No handler for method: " + method);
        }
    }
View Full Code Here

/* 181 */         ic = new InitialContext();
/*     */       }
/* 183 */       Proxy proxy = (Proxy)ic.lookup(this.jndiName);
/*     */
/* 186 */       InvocationHandler ih = Proxy.getInvocationHandler(proxy);
/* 187 */       return (EJBObject)ih.invoke(proxy, GET_EJB_OBJECT, new Object[] { this.id });
/*     */     }
/*     */     catch (RemoteException e)
/*     */     {
/* 191 */       throw e;
/*     */     }
View Full Code Here

  private final class Dispatcher implements InvocationHandler {
    @Override
    public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
      InvocationHandler invocationHandler = invocationMap.get(method);
      if (invocationHandler == null) throw new UnsupportedOperationException("No implement method: " + method);
      return invocationHandler.invoke(proxy, method, args);
    }
  }

}
View Full Code Here

    Assert.assertTrue("runner should be InvocationHandler", someDynamicService instanceof InvocationHandler);
    Assert.assertTrue("runner should be FilterModel", someDynamicService instanceof FilterModel);

    try {
      InvocationHandler invocationHandler = (InvocationHandler)someDynamicService;
      Assert.assertEquals("Daft result", invocationHandler.invoke(null, null, null));
    } catch (Throwable throwable) {
      throw new RuntimeException(throwable);
    }
  }
}
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.