Package org.springframework.util

Examples of org.springframework.util.MethodInvoker.invoke()


    MethodInvoker methodInvoker = new MethodInvoker();
    methodInvoker.setTargetClass(MethodInvokerTests.TestClass1.class);
    methodInvoker.setTargetMethod("nullArgument");
    methodInvoker.setArguments(new Object[] {null});
    methodInvoker.prepare();
    methodInvoker.invoke();
  }

  public void testInvokeWithIntArgument() throws Exception {
    ArgumentConvertingMethodInvoker methodInvoker = new ArgumentConvertingMethodInvoker();
    methodInvoker.setTargetClass(MethodInvokerTests.TestClass1.class);
View Full Code Here


      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 JMSException) {
        throw (JMSException) targetEx;
View Full Code Here

      if (logger.isDebugEnabled()) {
        logger.debug("Invoking method [" + name + "] on target [" + target + "] with arguments ["
            + ObjectUtils.nullSafeToString(args) + "]");
      }

      return (T) methodInvoker.invoke();
    }
    catch (Exception e) {
      ReflectionUtils.handleReflectionException(e);
    }
View Full Code Here

        beanMethod.setArguments(arguments);
        beanMethod.prepare();
       
        logger.debug("Invoking Bean: "+targetBean+"; Method: "+targetMethod+"; arguments: "+arguments+";");
       
        beanMethod.invoke();
      }catch(JobExecutionException e){
        throw e;
      }catch(Exception e){
        logger.error("定时任务[bean="+targetBean
            +",method="+targetMethod+"]执行异常:",e);
View Full Code Here

      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 JMSException) {
        throw (JMSException) targetEx;
View Full Code Here

      MethodInvoker methodInvoker = new MethodInvoker();
      methodInvoker.setTargetObject(getDelegate());
      methodInvoker.setTargetMethod(methodName);
      methodInvoker.setArguments(arguments);
      methodInvoker.prepare();
      return methodInvoker.invoke();
    }
    catch (InvocationTargetException ex) {
      throw new ListenerExecutionFailedException(
          "Listener method '" + methodName + "' threw exception", ex.getTargetException());
    }
View Full Code Here

      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 DataAccessException) {
        throw (DataAccessException) targetEx;
      }
View Full Code Here

        }
        return new Runnable() {
            @Override
            public void run() {
                try {
                    methodInvoker.invoke();
                } catch (Exception e) {
                    logger.error("run dynamic task error, task id is:" + taskId, e);
                    throw new DynamicTaskException("run dynamic task error, task id is:" + taskId, e);
                }
            }
View Full Code Here

    MethodInvoker methodInvoker = new MethodInvoker();
    methodInvoker.setTargetClass(TestClass1.class);
    methodInvoker.setTargetMethod("nullArgument");
    methodInvoker.setArguments(new Object[] {null});
    methodInvoker.prepare();
    methodInvoker.invoke();
  }

  @Test
  public void testInvokeWithIntArgument() throws Exception {
    ArgumentConvertingMethodInvoker methodInvoker = new ArgumentConvertingMethodInvoker();
View Full Code Here

      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 JMSException) {
        throw (JMSException) targetEx;
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.