Package javax.validation.constraints

Examples of javax.validation.constraints.Digits


    AnnotationDescriptor<Digits> descriptor = new AnnotationDescriptor<Digits>( Digits.class );
    descriptor.setValue( "integer", -1 );
    descriptor.setValue( "fraction", 1 );
    descriptor.setValue( "message", "{validator.digits}" );
    Digits p = AnnotationFactory.create( descriptor );

    DigitsValidatorForNumber constraint = new DigitsValidatorForNumber();
    constraint.initialize( p );
  }
View Full Code Here


    AnnotationDescriptor<Digits> descriptor = new AnnotationDescriptor<Digits>( Digits.class );
    descriptor.setValue( "integer", 1 );
    descriptor.setValue( "fraction", -1 );
    descriptor.setValue( "message", "{validator.digits}" );
    Digits p = AnnotationFactory.create( descriptor );

    DigitsValidatorForNumber constraint = new DigitsValidatorForNumber();
    constraint.initialize( p );
  }
View Full Code Here

  public void testTrailingZerosAreTrimmed() {
    AnnotationDescriptor<Digits> descriptor = new AnnotationDescriptor<Digits>( Digits.class );
    descriptor.setValue( "integer", 12 );
    descriptor.setValue( "fraction", 3 );
    descriptor.setValue( "message", "{validator.digits}" );
    Digits p = AnnotationFactory.create( descriptor );

    DigitsValidatorForNumber constraint = new DigitsValidatorForNumber();
    constraint.initialize( p );

    assertTrue( constraint.isValid( 0.001d, null ) );
View Full Code Here

TOP

Related Classes of javax.validation.constraints.Digits

Copyright © 2018 www.massapicom. 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.