/** * Invokes any @BeforeResult annotated methods * * @see com.opensymphony.xwork2.interceptor.PreResultListener#beforeResult(com.opensymphony.xwork2.ActionInvocation,String) */ public void beforeResult(ActionInvocation invocation, String resultCode) { Object action = invocation.getAction(); List<Method> methods = new ArrayList<Method>(AnnotationUtils.getAnnotatedMethods(action.getClass(), BeforeResult.class)); if (methods.size() > 0) { // methods are only sorted by priority Collections.sort(methods, new Comparator<Method>() { public int compare(Method method1, Method method2) { return comparePriorities(method1.getAnnotation(BeforeResult.class).priority(), method2.getAnnotation(BeforeResult.class).priority()); } }); for (Method m : methods) { try { m.invoke(action, (Object[]) null); } catch (Exception e) { throw new XWorkException(e); } } } }
final Object action = invocation.getAction(); invocation.addPreResultListener(this); List<Method> methods = new ArrayList<Method>(AnnotationUtils.getAnnotatedMethods(action.getClass(), Before.class)); if (methods.size() > 0) { methods = new ArrayList<Method>(AnnotationUtils.getAnnotatedMethods(action.getClass(), After.class));