List of usage examples for org.springframework.validation Errors popNestedPath
void popNestedPath() throws IllegalStateException;
From source file:com.springsource.hq.plugin.tcserver.serverconfig.ValidationUtils.java
/** * Performs validation of the given <code>Collection</code> of <code>Validator</code> instances. Each * <code>Validator</code> is treated as a self-validating domain object, i.e. the following is called upon each * <code>Validator</code>: <code>validator.validate(validator, errors)</code>. The given <code>identifier</code> is * used when pushing the path on the given <code>errors</code>, e.g. an identifier of 'foo' will result in * <code>foo[i]</code> being pushed, where i is the index of the validator in the given collection. The given * <code>errors</code> will be used to record any errors that are found. * //from w w w . j a v a 2 s . co m * @see Validator#validate(Object, Errors) * * @param selfValidatingItems The self-validating items to validate * @param identifier The identifier * @param errors Passed to each validator and to be used to record any errors */ public static void validateCollection(Collection<? extends Validator> selfValidatingItems, String identifier, Errors errors) { Iterator<? extends Validator> iterator = selfValidatingItems.iterator(); int index = 0; while (iterator.hasNext()) { errors.pushNestedPath(String.format("%s[%d]", identifier, index++)); Validator selfValidating = iterator.next(); selfValidating.validate(selfValidating, errors); errors.popNestedPath(); } }
From source file:it.f2informatica.core.validator.AbstractValidator.java
protected void invokeValidator(Validator validator, Object target, String nestedPath, Errors errors) { try {// w ww . java2s.c o m errors.pushNestedPath(nestedPath); ValidationUtils.invokeValidator(validator, target, errors); } finally { errors.popNestedPath(); } }
From source file:csns.web.validator.ItemValidator.java
@Override public void validate(Object target, Errors errors) { Item item = (Item) target;//from w ww . j a va 2 s . com errors.pushNestedPath("resource"); ValidationUtils.invokeValidator(resourceValidator, item.getResource(), errors); errors.popNestedPath(); }
From source file:org.openmrs.module.metadatasharing.model.validator.SubscriptionHeaderValidator.java
/** * @see org.springframework.validation.Validator#validate(java.lang.Object, * org.springframework.validation.Errors) * @should reject invalid package header * @should reject empty content URI/*from www .ja v a 2 s.co m*/ */ @Override public void validate(Object target, Errors errors) { SubscriptionHeader header = (SubscriptionHeader) target; errors.pushNestedPath("packageHeader"); ValidationUtils.invokeValidator(packageValidator, header.getPackageHeader(), errors); errors.popNestedPath(); ValidationUtils.rejectIfEmpty(errors, "contentUri", "metadatasharing.error.subscriptionHeader.contentUri.empty", "The contentUri cannot be empty"); }
From source file:com.create.validation.ListValidator.java
private void validate(List<?> targets, int index, Errors errors) { final String nestedPath = nestedPathConverter.getNestedPath(index); errors.pushNestedPath(nestedPath);//from ww w . j a v a 2 s.c om final Object target = targets.get(index); invokeValidator(validator, target, errors); errors.popNestedPath(); }
From source file:com.springsource.hq.plugin.tcserver.serverconfig.resources.jdbc.DbcpDataSource.java
public void validate(Object target, Errors errors) { DbcpDataSource dataSource = (DbcpDataSource) target; errors.pushNestedPath("general"); dataSource.getGeneral().validate(dataSource.getGeneral(), errors); errors.popNestedPath(); errors.pushNestedPath("connection"); dataSource.getConnection().validate(dataSource.getConnection(), errors); errors.popNestedPath();/*w w w . j a v a 2s. co m*/ errors.pushNestedPath("connectionPool"); dataSource.getConnectionPool().validate(dataSource.getConnectionPool(), errors); errors.popNestedPath(); }
From source file:com.springsource.hq.plugin.tcserver.serverconfig.configuration.jvm.Environment.java
public void validate(Object target, Errors errors) { Environment environment = (Environment) target; errors.pushNestedPath("jvmOptions"); environment.getJvmOptions().validate(environment.getJvmOptions(), errors); errors.popNestedPath(); }
From source file:com.springsource.hq.plugin.tcserver.serverconfig.resources.jdbc.TomcatDataSource.java
public void validate(Object target, Errors errors) { TomcatDataSource dataSource = (TomcatDataSource) target; errors.pushNestedPath("general"); dataSource.getGeneral().validate(dataSource.getGeneral(), errors); errors.popNestedPath(); errors.pushNestedPath("connection"); dataSource.getConnection().validate(dataSource.getConnection(), errors); errors.popNestedPath();//from w w w . java2 s. c om errors.pushNestedPath("connectionPool"); dataSource.getConnectionPool().validate(dataSource.getConnectionPool(), errors); errors.popNestedPath(); }
From source file:com.springsource.hq.plugin.tcserver.serverconfig.configuration.serverdefaults.ServerDefaults.java
public void validate(Object target, Errors errors) { ServerDefaults serverDefaults = (ServerDefaults) target; errors.pushNestedPath("jspDefaults"); serverDefaults.getJspDefaults().validate(serverDefaults.getJspDefaults(), errors); errors.popNestedPath(); errors.pushNestedPath("staticDefaults"); serverDefaults.getStaticDefaults().validate(serverDefaults.getStaticDefaults(), errors); errors.popNestedPath();/* w w w . j a v a2 s . c o m*/ }
From source file:com.springsource.hq.plugin.tcserver.serverconfig.configuration.general.GeneralConfig.java
public void validate(Object target, Errors errors) { GeneralConfig generalConfig = (GeneralConfig) target; errors.pushNestedPath("serverProperties"); generalConfig.getServerProperties().validate(generalConfig.getServerProperties(), errors); errors.popNestedPath(); errors.pushNestedPath("jmxListener"); generalConfig.getJmxListener().validate(generalConfig.getJmxListener(), errors); errors.popNestedPath();/*from w w w.jav a 2 s .com*/ }