use of com.opensymphony.xwork2.validator.validators.VisitorFieldValidator.AppendingValidatorContext in project struts by apache.
the class VisitorFieldValidator method validateObject.
private void validateObject(String fieldName, Object o, String visitorContext) throws ValidationException {
ValueStack stack = ActionContext.getContext().getValueStack();
stack.push(o);
ValidatorContext validatorContext;
if (appendPrefix) {
ValidatorContext parent = getValidatorContext();
validatorContext = new AppendingValidatorContext(parent, createTextProvider(o, parent), fieldName, getMessage(o));
} else {
ValidatorContext parent = getValidatorContext();
CompositeTextProvider textProvider = createTextProvider(o, parent);
validatorContext = new DelegatingValidatorContext(parent, textProvider, parent);
}
actionValidatorManager.validate(o, visitorContext, validatorContext);
stack.pop();
}
use of com.opensymphony.xwork2.validator.validators.VisitorFieldValidator.AppendingValidatorContext in project struts by apache.
the class AppendingValidatorContextTest method setUp.
@Override
protected void setUp() throws Exception {
super.setUp();
action = container.inject(VisitorValidatorTestAction.class);
TextProviderFactory tpf = container.getInstance(TextProviderFactory.class);
ValidatorContext vc1 = new DelegatingValidatorContext(action, tpf);
VisitorFieldValidator.AppendingValidatorContext vc2 = new AppendingValidatorContext(vc1, createTextProvider(action, vc1), FIRST_NAME, "");
validatorContext = new AppendingValidatorContext(vc2, createTextProvider(action, vc2), SECOND_NAME, "");
}
Aggregations