List of usage examples for org.springframework.util MethodInvoker getTargetMethod
@Nullable
public String getTargetMethod()
From source file:com.saysth.commons.quartz.JobMethodInvocationFailedException.java
/** * Constructor for JobMethodInvocationFailedException. * /*from w w w. j av a2 s . c om*/ * @param methodInvoker * the MethodInvoker used for reflective invocation * @param cause * the root cause (as thrown from the target method) */ public JobMethodInvocationFailedException(MethodInvoker methodInvoker, Throwable cause) { super("Invocation of method '" + methodInvoker.getTargetMethod() + "' on target class [" + methodInvoker.getTargetClass() + "] failed", cause); }
From source file:com.sshdemo.common.schedule.generate.quartz.EwcmsJobMethodInvocationFailedException.java
public EwcmsJobMethodInvocationFailedException(MethodInvoker methodInvoker, Throwable cause) { super((new StringBuilder("Invocation of method '")).append(methodInvoker.getTargetMethod()) .append("' on target class [").append(methodInvoker.getTargetClass()).append("] failed").toString(), cause);/*from ww w .j a va2s .co m*/ }
From source file:org.kuali.rice.krad.uif.lifecycle.finalize.InvokeFinalizerTask.java
/** * Invokes the finalize method for the component (if configured) and sets the render output for * the component to the returned method string (if method is not a void type) *//* w w w. j av a 2 s . c o m*/ @Override protected void performLifecycleTask() { Component component = (Component) getElementState().getElement(); String finalizeMethodToCall = component.getFinalizeMethodToCall(); MethodInvoker finalizeMethodInvoker = component.getFinalizeMethodInvoker(); if (StringUtils.isBlank(finalizeMethodToCall) && (finalizeMethodInvoker == null)) { return; } if (finalizeMethodInvoker == null) { finalizeMethodInvoker = new MethodInvoker(); } // if method not set on invoker, use finalizeMethodToCall, note staticMethod could be set(don't know since // there is not a getter), if so it will override the target method in prepare if (StringUtils.isBlank(finalizeMethodInvoker.getTargetMethod())) { finalizeMethodInvoker.setTargetMethod(finalizeMethodToCall); } // if target class or object not set, use view helper service if ((finalizeMethodInvoker.getTargetClass() == null) && (finalizeMethodInvoker.getTargetObject() == null)) { finalizeMethodInvoker.setTargetObject(ViewLifecycle.getHelper()); } // setup arguments for method List<Object> additionalArguments = component.getFinalizeMethodAdditionalArguments(); if (additionalArguments == null) { additionalArguments = new ArrayList<Object>(); } Object[] arguments = new Object[2 + additionalArguments.size()]; arguments[0] = component; arguments[1] = ViewLifecycle.getModel(); int argumentIndex = 1; for (Object argument : additionalArguments) { argumentIndex++; arguments[argumentIndex] = argument; } finalizeMethodInvoker.setArguments(arguments); // invoke finalize method try { LOG.debug("Invoking finalize method: " + finalizeMethodInvoker.getTargetMethod() + " for component: " + component.getId()); finalizeMethodInvoker.prepare(); Class<?> methodReturnType = finalizeMethodInvoker.getPreparedMethod().getReturnType(); if (StringUtils.equals("void", methodReturnType.getName())) { finalizeMethodInvoker.invoke(); } else { String renderOutput = (String) finalizeMethodInvoker.invoke(); component.setSelfRendered(true); component.setRenderedHtmlOutput(renderOutput); } } catch (Exception e) { LOG.error("Error invoking finalize method for component: " + component.getId(), e); throw new RuntimeException("Error invoking finalize method for component: " + component.getId(), e); } }