Package org.springframework.util

Examples of org.springframework.util.MethodInvoker


   * @return object returned by invoked method
   * @throws DynamicMethodInvocationException if the {@link MethodInvoker}
   * used throws exception
   */
  protected T invokeDelegateMethodWithArguments(Object[] args) throws Exception {
    MethodInvoker invoker = createMethodInvoker(targetObject, targetMethod);
    invoker.setArguments(args);
    return doInvoke(invoker);
  }
View Full Code Here


  /**
   * @return true if target class declares a method matching target method
   * name with given number of arguments of appropriate type.
   */
  private boolean targetClassDeclaresTargetMethod() {
    MethodInvoker invoker = createMethodInvoker(targetObject, targetMethod);

    Method[] memberMethods = invoker.getTargetClass().getMethods();
    Method[] declaredMethods = invoker.getTargetClass().getDeclaredMethods();

    List<Method> allMethods = new ArrayList<Method>();
    allMethods.addAll(Arrays.asList(memberMethods));
    allMethods.addAll(Arrays.asList(declaredMethods));

    String targetMethodName = invoker.getTargetMethod();

    for (Method method : allMethods) {
      if (method.getName().equals(targetMethodName)) {
        Class<?>[] params = method.getParameterTypes();
        if (arguments == null) {
View Full Code Here

   * @see #buildListenerArguments
   */
  protected Object invokeListenerMethod(String methodName, Object[] arguments, Message originalMessage)
      throws Exception {
    try {
      MethodInvoker methodInvoker = new MethodInvoker();
      methodInvoker.setTargetObject(getDelegate());
      methodInvoker.setTargetMethod(methodName);
      methodInvoker.setArguments(arguments);
      methodInvoker.prepare();
      return methodInvoker.invoke();
    }
    catch (InvocationTargetException ex) {
      Throwable targetEx = ex.getTargetException();
      if (targetEx instanceof IOException) {
        throw new AmqpIOException((IOException) targetEx);
View Full Code Here

TOP

Related Classes of org.springframework.util.MethodInvoker

Copyright © 2018 www.massapicom. 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.