Examples of SizeDef


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

  public void testProgrammaticAndAnnotationParameterConstraintsAddUp() {
    ConstraintMapping mapping = config.createConstraintMapping();
    mapping.type( GreetingService.class )
        .method( "sayHello", String.class )
        .parameter( 0 )
        .constraint( new SizeDef().min( 2 ).max( 10 ) );
    config.addMapping( mapping );

    try {
      GreetingService service = getValidatingProxy(
          wrappedObject,
View Full Code Here

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

  public void testReturnValueConstraint() {
    ConstraintMapping mapping = config.createConstraintMapping();
    mapping.type( GreetingService.class )
        .method( "greet", String.class )
        .returnValue()
        .constraint( new SizeDef().min( 1 ).max( 10 ) );
    config.addMapping( mapping );

    try {
      GreetingService service = getValidatingProxy(
          wrappedObject,
View Full Code Here

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

  public void testMultipleReturnValueConstraints() {
    ConstraintMapping mapping = config.createConstraintMapping();
    mapping.type( GreetingService.class )
        .method( "greet", String.class )
        .returnValue()
        .constraint( new SizeDef().min( 1 ).max( 10 ) )
        .constraint( new SizeDef().min( 2 ).max( 10 ) );
    config.addMapping( mapping );

    try {
      GreetingService service = getValidatingProxy(
          wrappedObject,
View Full Code Here

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

  public void testProgrammaticAndAnnotationReturnValueConstraintsAddUp() {
    ConstraintMapping mapping = config.createConstraintMapping();
    mapping.type( GreetingService.class )
        .method( "greet", String.class, String.class )
        .returnValue()
        .constraint( new SizeDef().min( 2 ).max( 10 ) );
    config.addMapping( mapping );

    try {
      GreetingService service = getValidatingProxy(
          wrappedObject,
View Full Code Here

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

  public void testOverridingMethodMayDefineSameConstraintsAsOverriddenMethod() {
    ConstraintMapping mapping = config.createConstraintMapping();
    mapping.type( GreetingService.class )
        .method( "greet", String.class )
        .parameter( 0 )
        .constraint( new SizeDef().min( 5 ).max( 10 ) )
        .type( GreetingServiceImpl.class )
        .method( "greet", String.class )
        .parameter( 0 )
        .constraint( new SizeDef().min( 5 ).max( 10 ) );
    config.addMapping( mapping );

    GreetingService service = getValidatingProxy( wrappedObject, config.buildValidatorFactory().getValidator() );

    try {
View Full Code Here

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

  public void testMultipleParameterConstraintsAtSameParameter() {
    ConstraintMapping mapping = config.createConstraintMapping();
    mapping.type( GreetingService.class )
        .method( "greet", String.class )
        .parameter( 0 )
        .constraint( new SizeDef().min( 1 ).max( 10 ) )
        .constraint( new SizeDef().min( 2 ).max( 10 ) );
    config.addMapping( mapping );

    try {
      GreetingService service = getValidatingProxy(
          wrappedObject,
View Full Code Here

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

        .property( "manufacturer", FIELD )
          .constraint( new NotNullDef() )
        .property( "licensePlate", FIELD )
          .ignoreAnnotations()
          .constraint( new NotNullDef() )
          .constraint( new SizeDef().min( 2 ).max( 14 ) )
      .type( RentalCar.class )
        .property( "rentalStation", METHOD )
          .constraint( new NotNullDef() );

    Validator validator = configuration.addMapping( constraintMapping )
View Full Code Here

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

    constraintMapping
      .type( Car.class )
        .constructor( String.class )
          .parameter( 0 )
            .constraint( new SizeDef().min( 3 ).max( 50 ) )
          .returnValue()
            .valid()
        .method( "drive", int.class )
          .parameter( 0 )
            .constraint( new MaxDef().value ( 75 ) )
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.