All Downloads are FREE. Search and download functionalities are using the official Maven repository.

rm-generator.1.2.1.source-code.bean_validator.vm Maven / Gradle / Ivy

There is a newer version: 1.5.0
Show 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.getTableSearchPattern()");
#foreach ($className in $class.ClassNames)
		beanValidator.validateBean(new ${className}());
#end
	}
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy