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

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


                constraintHelper
            );
          }
          break;
        case TYPE:
          ConstrainedType constrainedType = (ConstrainedType) constrainedElement;
          propertyBuilder = new PropertyMetaData.Builder(
              constrainedType,
              constraintHelper
          );
          break;
View Full Code Here


                constraintHelper
            );
          }
          break;
        case TYPE:
          ConstrainedType constrainedType = (ConstrainedType) constrainedElement;
          propertyBuilder = new PropertyMetaData.Builder(
              beanClass,
              constrainedType,
              constraintHelper
          );
View Full Code Here

    //TODO GM: currently class level constraints are represented by a PropertyMetaData. This
    //works but seems somewhat unnatural
    Set<MetaConstraint<?>> classLevelConstraints = getClassLevelConstraints( beanClass );
    if ( !classLevelConstraints.isEmpty() ) {
      ConstrainedType classLevelMetaData =
          new ConstrainedType(
              ConfigurationSource.ANNOTATION,
              ConstraintLocation.forClass( beanClass ),
              classLevelConstraints
          );
      constrainedElements.add( classLevelMetaData );
View Full Code Here

  @Test
  @TestForIssue(jiraKey = "HV-626")
  public void onlyLocallyDefinedConstraintsAreConsidered() {
    List<BeanConfiguration<? super Person>> beanConfigurations = provider.getBeanConfigurationForHierarchy( Person.class );

    ConstrainedType personType = findConstrainedType( beanConfigurations, Person.class );
    assertThat( personType.getConstraints() ).hasSize( 1 );
    ConstraintDescriptor<?> constraintInSubType = personType.getConstraints()
        .iterator()
        .next()
        .getDescriptor();
    assertThat( constraintInSubType.getAnnotation().annotationType() ).isEqualTo( ScriptAssert.class );

    ConstrainedType personBaseType = findConstrainedType( beanConfigurations, PersonBase.class );
    assertThat( personBaseType.getConstraints() ).hasSize( 1 );

    ConstraintDescriptor<?> constraintInSuperType = personBaseType.getConstraints()
        .iterator()
        .next()
        .getDescriptor();
    assertThat( constraintInSuperType.getAnnotation().annotationType() ).isEqualTo( ClassLevelConstraint.class );
  }
View Full Code Here

  protected <T> ConstrainedType findConstrainedType(Iterable<BeanConfiguration<? super T>> beanConfigurations,
                            Class<? super T> type) {
    for ( BeanConfiguration<?> oneConfiguration : beanConfigurations ) {
      for ( ConstrainedElement constrainedElement : oneConfiguration.getConstrainedElements() ) {
        if ( constrainedElement.getLocation().getMember() == null ) {
          ConstrainedType constrainedType = (ConstrainedType) constrainedElement;
          if ( constrainedType.getLocation().getDeclaringClass().equals( type ) ) {
            return constrainedType;
          }
        }
      }
    }
View Full Code Here

                constraintHelper
            );
          }
          break;
        case TYPE:
          ConstrainedType constrainedType = (ConstrainedType) constrainedElement;
          propertyBuilder = new PropertyMetaData.Builder(
              beanClass,
              constrainedType,
              constraintHelper
          );
View Full Code Here

  private Set<ConstrainedElement> buildConstraintElements(ConstraintHelper constraintHelper, ParameterNameProvider parameterNameProvider) {
    Set<ConstrainedElement> elements = newHashSet();

    //class-level configuration
    elements.add(
        new ConstrainedType(
            ConfigurationSource.API,
            ConstraintLocation.forClass( beanClass ),
            getConstraints( constraintHelper )
        )
    );
View Full Code Here

    //TODO GM: currently class level constraints are represented by a PropertyMetaData. This
    //works but seems somewhat unnatural
    Set<MetaConstraint<?>> classLevelConstraints = getClassLevelConstraints( beanClass );
    if ( !classLevelConstraints.isEmpty() ) {
      ConstrainedType classLevelMetaData =
          new ConstrainedType(
              ConfigurationSource.ANNOTATION,
              new BeanConstraintLocation( beanClass ),
              classLevelConstraints
          );
      constrainedElements.add( classLevelMetaData );
View Full Code Here

    //TODO GM: currently class level constraints are represented by a PropertyMetaData. This
    //works but seems somewhat unnatural
    Set<MetaConstraint<?>> classLevelConstraints = getClassLevelConstraints( beanClass );
    if ( !classLevelConstraints.isEmpty() ) {
      ConstrainedType classLevelMetaData =
          new ConstrainedType(
              ConfigurationSource.ANNOTATION,
              new BeanConstraintLocation( beanClass ),
              classLevelConstraints
          );
      constrainedElements.add( classLevelMetaData );
View Full Code Here

                constraintHelper
            );
          }
          break;
        case TYPE:
          ConstrainedType constrainedType = (ConstrainedType) constrainedElement;
          propertyBuilder = new PropertyMetaData.Builder(
              beanClass,
              constrainedType,
              constraintHelper
          );
View Full Code Here

TOP

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

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.