public void validate(Object object, String context, String method) throws ValidationException { ValidatorContext validatorContext = new DelegatingValidatorContext(object); validate(object, context, validatorContext, method); }
public void validate(Object object, String context, String method) throws ValidationException { ValidatorContext validatorContext = new DelegatingValidatorContext(object); validate(object, context, validatorContext, method); }
protected XWork2ScopeValidator(Class<O> type, String context, Set<String> fieldNames, ValueStack vs) { this.type = type; this.context = context; this.fieldNames = fieldNames; validationSupport = new ValidationAwareSupport(); validationContext = new DelegatingValidatorContext(validationSupport, null, new DefaultLocaleProvider()); if (vs == null) { // create a standalone value stack vs = XWork2ValidatorUtil.createValuestack(); if (log.isDebugEnabled()) { log.debug("create a standalone value stack " + vs); } } else { if (log.isDebugEnabled()) { log.debug("use given value stack " + vs); } } this.vs = vs; validator = XWork2ValidatorUtil.newValidationManager(vs); }
validatorContext = new DelegatingValidatorContext(object);
public XWorkBeanValidator(Class<B> beanClass, String contextName, boolean includeDefaultContext, ValueStack vs) { this.beanClass = beanClass; this.includeDefaultContext = includeDefaultContext; validationSupport = new ValidationAwareSupport(); validationContext = new DelegatingValidatorContext(validationSupport); if (vs == null) { // create a standalone value stack ConfigurationManager confManager = new ConfigurationManager(); Configuration conf = confManager.getConfiguration(); vs = conf.getContainer().getInstance(ValueStackFactory.class).createValueStack(); if (log.isDebugEnabled()) { log.info("create a standalone value stack " + vs); } } else { if (log.isDebugEnabled()) { log.debug("use given value stack " + vs); } } context = new ActionContext(vs.getContext()); ActionContext.setContext(context); // init validator validator = context.getContainer().getInstance(ActionValidatorManager.class, "no-annotations"); // init context setContextName(contextName); }
private void validateObject(String fieldName, Object o, String visitorContext) throws ValidationException { ValueStack stack = ActionContext.getContext().getValueStack(); stack.push(o); ValidatorContext validatorContext; if (appendPrefix) { validatorContext = new AppendingValidatorContext(getValidatorContext(), o, fieldName, getMessage(o)); } else { ValidatorContext parent = getValidatorContext(); validatorContext = new DelegatingValidatorContext(parent, DelegatingValidatorContext.makeTextProvider(o, parent), parent); } actionValidatorManager.validate(o, visitorContext, validatorContext); stack.pop(); }