return ctx.wrap( new Interceptor() {
public Resolution intercept(ExecutionContext context) throws Exception {
// Run any of the annotated validation methods
Method[] validations = findCustomValidationMethods(bean.getClass());
for (Method validation : validations) {
ValidationMethod ann = validation.getAnnotation(ValidationMethod.class);
boolean run = (ann.when() == ValidationState.ALWAYS)
|| (ann.when() == ValidationState.DEFAULT && alwaysInvokeValidate)
|| errors.isEmpty();
if (run && applies(ann, ctx.getActionBeanContext().getEventName())) {
Class<?>[] args = validation.getParameterTypes();
if (args.length == 1 && args[0].equals(ValidationErrors.class)) {