Package org.hibernate.validator.internal.metadata.raw

Examples of org.hibernate.validator.internal.metadata.raw.ConstrainedField


    Set<MetaConstraint<?>> typeArgumentsConstraints = findTypeAnnotationConstraintsForMember( field );
    if ( !typeArgumentsConstraints.isEmpty() && !ReflectionHelper.isIterable( ReflectionHelper.typeOf( field ) ) ) {
      unwrapMode = UnwrapMode.UNWRAP;
    }

    return new ConstrainedField(
        ConfigurationSource.ANNOTATION,
        ConstraintLocation.forProperty( field ),
        constraints,
        typeArgumentsConstraints,
        groupConversions,
View Full Code Here


  @Test
  public void noGroupConversionOnField() throws Exception {
    //when
    List<BeanConfiguration<? super User>> beanConfigurations = provider.getBeanConfigurationForHierarchy( User.class );
    ConstrainedField field = findConstrainedField( beanConfigurations, User.class, "mail" );

    //then
    assertThat( field.getGroupConversions() ).isEmpty();
  }
View Full Code Here

  @Test
  public void singleGroupConversionOnField() throws Exception {
    //when
    List<BeanConfiguration<? super User>> beanConfigurations = provider.getBeanConfigurationForHierarchy( User.class );
    ConstrainedField field = findConstrainedField( beanConfigurations, User.class, "phone" );

    //then
    Map<Class<?>, Class<?>> expected = newHashMap();
    expected.put( Default.class, BasicNumber.class );

    assertThat( field.getGroupConversions() ).isEqualTo( expected );
  }
View Full Code Here

  @Test
  public void multipleGroupConversionsOnField() throws Exception {
    //when
    List<BeanConfiguration<? super User>> beanConfigurations = provider.getBeanConfigurationForHierarchy( User.class );
    ConstrainedField field = findConstrainedField( beanConfigurations, User.class, "address" );

    //then
    Map<Class<?>, Class<?>> expected = newHashMap();
    expected.put( Default.class, BasicPostal.class );
    expected.put( Complete.class, FullPostal.class );

    assertThat( field.getGroupConversions() ).isEqualTo( expected );
  }
View Full Code Here

  public void unwrapValidatedValueOnField() throws Exception {
    List<BeanConfiguration<? super GolfPlayer>> beanConfigurations = provider.getBeanConfigurationForHierarchy(
        GolfPlayer.class
    );

    ConstrainedField constrainedField = findConstrainedField( beanConfigurations, GolfPlayer.class, "name" );

    assertEquals( constrainedField.unwrapMode(), UnwrapMode.UNWRAP );
  }
View Full Code Here

  public void testAutomaticUnwrapValidatedValueOnField() throws Exception {
    List<BeanConfiguration<? super GolfPlayer>> beanConfigurations = provider.getBeanConfigurationForHierarchy(
        GolfPlayer.class
    );

    ConstrainedField constrainedField = findConstrainedField( beanConfigurations, GolfPlayer.class, "nickname" );

    assertEquals( constrainedField.unwrapMode(), UnwrapMode.AUTOMATIC );
  }
View Full Code Here

      this.constraintHelper = constraintHelper;
      this.executableHelper = executableHelper;

      switch ( constrainedElement.getKind() ) {
        case FIELD:
          ConstrainedField constrainedField = (ConstrainedField) constrainedElement;
          propertyBuilder = new PropertyMetaData.Builder(
              beanClass,
              constrainedField,
              constraintHelper
          );
View Full Code Here

    return typeContext.method( name, parameterTypes );
  }

  public ConstrainedElement build(ConstraintHelper constraintHelper) {
    if ( member instanceof Field ) {
      return new ConstrainedField(
          ConfigurationSource.API,
          ConstraintLocation.forProperty( member ),
          getConstraints( constraintHelper ),
          groupConversions,
          isCascading,
View Full Code Here

        field
    );

    boolean isCascading = field.isAnnotationPresent( Valid.class );

    return new ConstrainedField(
        ConfigurationSource.ANNOTATION,
        new BeanConstraintLocation( field ),
        constraints,
        isCascading
    );
View Full Code Here

        field.getAnnotation( ConvertGroup.List.class )
    );

    boolean isCascading = field.isAnnotationPresent( Valid.class );

    return new ConstrainedField(
        ConfigurationSource.ANNOTATION,
        new BeanConstraintLocation( field ),
        constraints,
        groupConversions,
        isCascading
View Full Code Here

TOP

Related Classes of org.hibernate.validator.internal.metadata.raw.ConstrainedField

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.