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

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


          getterType.getConvertGroup(),
          defaultPackage
      );

      // TODO HV-919 Support specification of type parameter constraints via XML and API
      ConstrainedExecutable constrainedGetter = new ConstrainedExecutable(
          ConfigurationSource.XML,
          constraintLocation,
          Collections.<ConstrainedParameter>emptyList(),
          Collections.<MetaConstraint<?>>emptySet(),
          metaConstraints,
View Full Code Here


              constraintHelper
          );
          break;
        case CONSTRUCTOR:
        case METHOD:
          ConstrainedExecutable constrainedExecutable = (ConstrainedExecutable) constrainedElement;
          methodBuilder = new ExecutableMetaData.Builder(
              beanClass,
              constrainedExecutable,
              constraintHelper,
              executableHelper
          );

          if ( constrainedExecutable.isGetterMethod() ) {
            propertyBuilder = new PropertyMetaData.Builder(
                beanClass,
                constrainedExecutable,
                constraintHelper
            );
View Full Code Here

      if ( propertyBuilder != null && propertyBuilder.accepts( constrainedElement ) ) {
        propertyBuilder.add( constrainedElement );

        if ( !added && constrainedElement.getKind() == ConstrainedElementKind.METHOD && methodBuilder == null ) {
          ConstrainedExecutable constrainedMethod = (ConstrainedExecutable) constrainedElement;
          methodBuilder = new ExecutableMetaData.Builder(
              beanClass,
              constrainedMethod,
              constraintHelper,
              executableHelper
View Full Code Here

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

    ConstrainedExecutable executable = findConstrainedMethod( beanConfigurations, B.class, "getNames" );
    assertThat( executable.getTypeArgumentsConstraints() ).hasSize( 2 );
    assertThat( getAnnotationsTypes( executable.getTypeArgumentsConstraints() ) ).contains(
        NotNullTypeUse.class, NotBlankTypeUse.class
    );
  }
View Full Code Here

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

    ConstrainedExecutable executable = findConstrainedMethod( beanConfigurations, C.class, "returnNames" );
    assertThat( executable.getTypeArgumentsConstraints() ).hasSize( 2 );
    assertThat( getAnnotationsTypes( executable.getTypeArgumentsConstraints() ) ).contains(
        NotNullTypeUse.class, NotBlankTypeUse.class
    );
  }
View Full Code Here

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

    ConstrainedExecutable executable = findConstrainedMethod(
        beanConfigurations,
        D.class,
        "setValues",
        String.class,
        Integer.class,
        List.class
    );
    ConstrainedParameter parameter = executable.getParameterMetaData( 2 );
    assertThat( parameter.getTypeArgumentsConstraints() ).hasSize( 2 );
    assertThat( getAnnotationsTypes( parameter.getTypeArgumentsConstraints() ) ).contains(
        NotNullTypeUse.class, NotBlankTypeUse.class
    );
  }
View Full Code Here

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

    ConstrainedExecutable executable = findConstrainedConstructor(
        beanConfigurations,
        E.class,
        String.class,
        Integer.class,
        List.class
    );

    ConstrainedParameter parameter = executable.getParameterMetaData( 2 );
    assertThat( parameter.getTypeArgumentsConstraints() ).hasSize( 2 );
    assertThat( getAnnotationsTypes( parameter.getTypeArgumentsConstraints() ) ).contains(
        NotNullTypeUse.class, NotBlankTypeUse.class
    );
  }
View Full Code Here

          member.getAnnotation( ConvertGroup.List.class )
      );
      isCascading = executable.getAccessibleObject().isAnnotationPresent( Valid.class );
    }

    return new ConstrainedExecutable(
        ConfigurationSource.ANNOTATION,
        ConstraintLocation.forReturnValue( executable ),
        parameterConstraints,
        crossParameterConstraints,
        returnValueConstraints,
View Full Code Here

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

    assertThat( beanConfigurations ).hasSize( 2 );

    ConstrainedExecutable constructor = findConstrainedConstructor( beanConfigurations, Foo.class, String.class );

    assertThat( constructor.getKind() ).isEqualTo( ConstrainedElementKind.CONSTRUCTOR );
    assertThat( constructor.isConstrained() ).isTrue();
    assertThat( constructor.isCascading() ).isFalse();
    assertThat( constructor.getConstraints() ).hasSize( 1 );

    MetaConstraint<?> constraint = constructor.getConstraints().iterator().next();
    assertThat( constraint.getDescriptor().getAnnotation().annotationType() ).isEqualTo( NotNull.class );
    assertThat( constraint.getElementType() ).isEqualTo( ElementType.CONSTRUCTOR );
  }
View Full Code Here

    //when
    List<BeanConfiguration<? super Calendar>> beanConfigurations = provider.getBeanConfigurationForHierarchy(
        Calendar.class
    );

    ConstrainedExecutable createEvent = findConstrainedMethod(
        beanConfigurations,
        Calendar.class,
        "createEvent",
        DateMidnight.class,
        DateMidnight.class
    );

    //then
    assertThat( createEvent.isConstrained() ).isTrue();
    assertThat( createEvent.isCascading() ).isFalse();
    assertThat( createEvent.getKind() ).isEqualTo( ConstrainedElementKind.METHOD );
    assertThat( createEvent.getConstraints() ).as( "No return value constraints expected" ).isEmpty();
    assertThat( createEvent.getCrossParameterConstraints() ).hasSize( 1 );

    ConstraintLocation location = createEvent.getLocation();

    assertThat( location.getMember() ).isEqualTo(
        Calendar.class.getMethod(
            "createEvent",
            DateMidnight.class,
            DateMidnight.class
        )
    );

    MetaConstraint<?> constraint = createEvent.getCrossParameterConstraints().iterator().next();

    assertThat(
        constraint.getDescriptor()
            .getAnnotation()
            .annotationType()
View Full Code Here

TOP

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

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.