Examples of EANDef


Examples of org.hibernate.validator.cfg.defs.EANDef

  public void testProgrammaticConstraint() {
    final HibernateValidatorConfiguration config = getConfiguration( HibernateValidator.class );
    ConstraintMapping mapping = config.createConstraintMapping();
    mapping.type( Product.class )
        .property( "ean", FIELD )
        .constraint( new EANDef().type( EAN.Type.EAN13 ) );
    config.addMapping( mapping );
    Validator validator = config.buildValidatorFactory().getValidator();

    Product product = new Product( "1234567891011" );
    Set<ConstraintViolation<Product>> constraintViolations = validator.validate( product );
View Full Code Here

Examples of org.hibernate.validator.cfg.defs.EANDef

  public void testProgrammaticConstraint() {
    final HibernateValidatorConfiguration config = getConfiguration( HibernateValidator.class );
    ConstraintMapping mapping = config.createConstraintMapping();
    mapping.type( Product.class )
        .property( "ean", FIELD )
        .constraint( new EANDef().type( EAN.Type.EAN8 ) );
    config.addMapping( mapping );
    Validator validator = config.buildValidatorFactory().getValidator();

    Product product = new Product( "12345678" );
    Set<ConstraintViolation<Product>> constraintViolations = validator.validate( product );
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.