1 3 package jodd.madvoc; 4 5 import jodd.introspector.DefaultIntrospector; 6 import jodd.madvoc.interceptor.ActionInterceptor; 7 8 import java.lang.reflect.Method ; 9 10 13 public class ActionConfig { 14 15 public final String actionPath; 16 public Class actionClass; 17 public Method actionMethod; 18 public ActionInterceptor[] interceptors; 19 public int usage; 20 21 24 public ActionConfig(String actionPath, Class actionClass, Method actionMethod, ActionInterceptor[] actionInterceptors) { 25 this.actionPath = actionPath; 26 this.actionClass = actionClass; 27 this.actionMethod = actionMethod; 28 this.interceptors = actionInterceptors; 29 this.usage = 0; 30 } 31 32 33 36 public ActionConfig(String actionPath, Class actionClass, String actionMethodName, ActionInterceptor[] actionInterceptors) { 37 Method actionMethod = DefaultIntrospector.lookup(actionClass).getMethod(actionMethodName); 38 if (actionMethod == null) { 39 throw new MadvocException("Provided action class doesn't contain public method '" + actionMethodName + "'."); 40 } 41 this.actionPath = actionPath; 42 this.actionClass = actionClass; 43 this.actionMethod = actionMethod; 44 this.interceptors = actionInterceptors; 45 this.usage = 0; 46 } 47 48 49 50 52 55 public ActionConfig clone(String newActionPath) { 56 return new ActionConfig(newActionPath, this.actionClass, this.actionMethod, this.interceptors); 57 } 58 59 60 61 63 64 public String toString() { 65 return "action: " + actionPath + " -> " + getActionString(); 66 } 67 68 public String getActionString() { 69 return actionClass.getName() + '#' + actionMethod.getName() + "()"; 70 } 71 } 72 | Popular Tags |