1 package com.atlassian.xwork12;
2
3 import com.atlassian.xwork.XWorkVersionSupport;
4 import com.opensymphony.xwork.Action;
5 import com.opensymphony.xwork.ActionInvocation;
6
7 import java.lang.reflect.Method;
8
9
10
11
12 public class Xwork12VersionSupport implements XWorkVersionSupport
13 {
14 public Action extractAction(ActionInvocation invocation)
15 {
16 return (Action) invocation.getAction();
17 }
18
19 public Method extractMethod(ActionInvocation invocation) throws NoSuchMethodException
20 {
21 final Class<?> actionClass = invocation.getAction().getClass();
22 final String methodName = invocation.getProxy().getMethod();
23
24 try
25 {
26 return actionClass.getMethod(methodName);
27 }
28 catch (NoSuchMethodException e)
29 {
30 try
31 {
32 String altMethodName = "do" + methodName.substring(0, 1).toUpperCase() + methodName.substring(1);
33 return actionClass.getMethod(altMethodName);
34 }
35 catch (NoSuchMethodException e1) {
36
37 throw e;
38 }
39 }
40 }
41 }