Relaxed final declarations and protected doInvoke methods

Issue: SPR-12484
(cherry picked from commit 2496d68)
This commit is contained in:
Juergen Hoeller
2014-12-01 15:07:24 +01:00
parent 50c578c5a0
commit 90ae073854
3 changed files with 49 additions and 44 deletions

View File

@@ -29,13 +29,14 @@ import org.springframework.messaging.handler.HandlerMethod;
import org.springframework.util.ReflectionUtils;
/**
* Invokes the handler method for a given message after resolving
* its method argument values through registered {@link HandlerMethodArgumentResolver}s.
* Invokes the handler method for a given message after resolving its method argument
* values through registered {@link HandlerMethodArgumentResolver}s.
*
* <p>Use {@link #setMessageMethodArgumentResolvers(HandlerMethodArgumentResolverComposite)}
* to customize the list of argument resolvers.
*
* @author Rossen Stoyanchev
* @author Juergen Hoeller
* @since 4.0
*/
public class InvocableHandlerMethod extends HandlerMethod {
@@ -66,7 +67,9 @@ public class InvocableHandlerMethod extends HandlerMethod {
* @param parameterTypes the method parameter types
* @throws NoSuchMethodException when the method cannot be found
*/
public InvocableHandlerMethod(Object bean, String methodName, Class<?>... parameterTypes) throws NoSuchMethodException {
public InvocableHandlerMethod(Object bean, String methodName, Class<?>... parameterTypes)
throws NoSuchMethodException {
super(bean, methodName, parameterTypes);
}
@@ -93,7 +96,7 @@ public class InvocableHandlerMethod extends HandlerMethod {
* @throws Exception raised if no suitable argument resolver can be found,
* or the method raised an exception
*/
public final Object invoke(Message<?> message, Object... providedArgs) throws Exception {
public Object invoke(Message<?> message, Object... providedArgs) throws Exception {
Object[] args = getMethodArgumentValues(message, providedArgs);
if (logger.isTraceEnabled()) {
StringBuilder sb = new StringBuilder("Invoking [");
@@ -102,7 +105,7 @@ public class InvocableHandlerMethod extends HandlerMethod {
sb.append(Arrays.asList(args));
logger.trace(sb.toString());
}
Object returnValue = invoke(args);
Object returnValue = doInvoke(args);
if (logger.isTraceEnabled()) {
logger.trace("Method [" + getMethod().getName() + "] returned [" + returnValue + "]");
}
@@ -176,10 +179,11 @@ public class InvocableHandlerMethod extends HandlerMethod {
return null;
}
/**
* Invoke the handler method with the given argument values.
*/
private Object invoke(Object... args) throws Exception {
protected Object doInvoke(Object... args) throws Exception {
ReflectionUtils.makeAccessible(getBridgedMethod());
try {
return getBridgedMethod().invoke(getBean(), args);