rm-generator.1.5.0.source-code.bean_validator.vm Maven / Gradle / Ivy
The newest version!
## Velocity template to generate the validator for all generated Java Bean classes
package $class.PackageName;
#if ($class.hasDataSourceName())
import org.noorm.jdbc.DataSourceProvider;
#end
import org.noorm.validation.BeanValidator;
/**
* Validator for all Java Beans generated in $class.PackageName
* DO NOT EDIT! This file has been auto-generated by NoORM
*/
public class GenericBeanValidator {
#if ($class.hasDataSourceName())
private static final String DATA_SOURCE_NAME = "$class.getDataSourceName()";
#end
private BeanValidator beanValidator = new BeanValidator();
public void validateDatabase() {
#if ($class.hasDataSourceName())
DataSourceProvider.setActiveDataSource(DATA_SOURCE_NAME);
#end
beanValidator.loadMetadata("$class.getSchemaPattern()", "$class.getTableNamePattern()");
#foreach ($className in $class.ClassNames)
beanValidator.validateBean(new ${className}());
#end
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy