Package org.hibernate.validator.cfg

Examples of org.hibernate.validator.cfg.ConstraintMapping.type()


  }

  @Test
  public void cascadeConfiguredOnFieldIsNotEvaluatedByMethodValidation() {
    ConstraintMapping mapping = config.createConstraintMapping();
    mapping.type( GreetingServiceImpl.class )
        .property( "user", ElementType.FIELD )
        .valid();
    config.addMapping( mapping );

    GreetingService service = getValidatingProxy( wrappedObject, config.buildValidatorFactory().getValidator() );
View Full Code Here


  }

  @Test
  public void constraintConfiguredOnMethodIsEvaluatedByPropertyValidation() {
    ConstraintMapping mapping = config.createConstraintMapping();
    mapping.type( GreetingService.class )
        .method( "getHello" )
        .returnValue()
        .constraint( new NotNullDef() );
    config.addMapping( mapping );
View Full Code Here

  }

  @Test
  public void cascadeConfiguredOnMethodIsEvaluatedByPropertyValidation() {
    ConstraintMapping mapping = config.createConstraintMapping();
    mapping.type( GreetingService.class )
        .method( "getUser" )
        .returnValue()
        .valid();
    config.addMapping( mapping );
View Full Code Here

  @Test
  @TestForIssue(jiraKey = "HV-769")
  public void shouldDetermineConstraintTargetForReturnValueConstraint() {
    ConstraintMapping mapping = config.createConstraintMapping();
    mapping.type( GreetingService.class )
        .method( "greet", String.class, String.class )
        .returnValue()
        .constraint(
            new GenericConstraintDef<GenericAndCrossParameterConstraint>(
                GenericAndCrossParameterConstraint.class
View Full Code Here

  @Test
  @TestForIssue(jiraKey = "HV-642")
  public void crossParameterConstraint() {
    ConstraintMapping mapping = config.createConstraintMapping();
    mapping.type( GreetingService.class )
        .method( "greet", String.class, String.class )
        .crossParameter()
        .constraint(
            new GenericConstraintDef<GenericAndCrossParameterConstraint>(
                GenericAndCrossParameterConstraint.class
View Full Code Here

  @Test
  @TestForIssue(jiraKey = "HV-812")
  public void testProgrammaticMod11Constraint() {
    final HibernateValidatorConfiguration config = getConfiguration( HibernateValidator.class );
    ConstraintMapping mapping = config.createConstraintMapping();
    mapping.type( Product.class )
        .property( "productNumber", FIELD )
        .constraint(
            new Mod11CheckDef()
                .threshold( Integer.MAX_VALUE )
                .startIndex( 0 )
View Full Code Here

        .byProvider( HibernateValidator.class )
        .configure();

    ConstraintMapping constraintMapping = configuration.createConstraintMapping();

    constraintMapping
      .type( Car.class )
        .property( "manufacturer", FIELD )
          .constraint( new NotNullDef() )
        .property( "licensePlate", FIELD )
          .ignoreAnnotations()
View Full Code Here

        .byProvider( HibernateValidator.class )
        .configure();

    ConstraintMapping constraintMapping = configuration.createConstraintMapping();

    constraintMapping
      .type( Car.class )
        .property( "licensePlate", FIELD )
          .constraint( new GenericConstraintDef<CheckCase>( CheckCase.class )
            .param( "value", CaseMode.UPPER )
          );
View Full Code Here

        .byProvider( HibernateValidator.class )
        .configure();

    ConstraintMapping constraintMapping = configuration.createConstraintMapping();

    constraintMapping
      .type( Car.class )
        .property( "driver", FIELD )
          .constraint( new NotNullDef() )
          .valid()
          .convertGroup( Default.class ).to( PersonDefault.class )
View Full Code Here

        .byProvider( HibernateValidator.class )
        .configure();

    ConstraintMapping constraintMapping = configuration.createConstraintMapping();

    constraintMapping
      .type( Car.class )
        .constructor( String.class )
          .parameter( 0 )
            .constraint( new SizeDef().min( 3 ).max( 50 ) )
          .returnValue()
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.