Package javax.validation.metadata

Examples of javax.validation.metadata.ParameterDescriptor


        constraintDescriptors.size(),
        0,
        "No local constraint for CustomerRepositoryExt#createCustomer(), arg1, expected."
    );

    ParameterDescriptor createCustomerParameter2OnBaseType = getParameterDescriptor(
        CustomerRepository.class,
        "createCustomer",
        new Class<?>[] { CharSequence.class, String.class },
        1
    );

    constraintDescriptors =
        createCustomerParameter2OnBaseType.findConstraints()
            .lookingAt( Scope.LOCAL_ELEMENT )
            .getConstraintDescriptors();

    assertEquals(
        constraintDescriptors.size(),
View Full Code Here


  @Test
  public void testIsCascaded() {
    assertFalse( createCustomerParameter1.isCascaded() );

    ParameterDescriptor saveCustomerParameter = getParameterDescriptor(
        CustomerRepositoryExt.class, "saveCustomer", new Class<?>[] { Customer.class }, 0
    );
    assertTrue( saveCustomerParameter.isCascaded() );
  }
View Full Code Here

    );

    List<ParameterDescriptor> parameterDescriptors = constructorDescriptor.getParameterDescriptors();
    assertThat( parameterDescriptors ).hasSize( 2 );

    ParameterDescriptor parameterDescriptor1 = parameterDescriptors.get( 0 );
    assertThat( parameterDescriptor1.getElementClass() ).isEqualTo( String.class );
    assertThat( parameterDescriptor1.getIndex() ).isEqualTo( 0 );
    assertThat( parameterDescriptor1.getName() ).isEqualTo( "arg0" );
    assertThat( parameterDescriptor1.hasConstraints() ).isTrue();
    assertThat( parameterDescriptor1.isCascaded() ).isFalse();

    ParameterDescriptor parameterDescriptor2 = parameterDescriptors.get( 1 );
    assertThat( parameterDescriptor2.getElementClass() ).isEqualTo( Customer.class );
    assertThat( parameterDescriptor2.getIndex() ).isEqualTo( 1 );
    assertThat( parameterDescriptor2.getName() ).isEqualTo( "arg1" );
    assertThat( parameterDescriptor2.hasConstraints() ).isFalse();
    assertThat( parameterDescriptor2.isCascaded() ).isTrue();
  }
View Full Code Here

    //always returns an empty set; constraints are retrievable by navigating to
    //one of the sub-descriptors, e.g. for the return value
    assertTrue( driveAwayDescriptor.getConstraintDescriptors().isEmpty() );

    ParameterDescriptor speedDescriptor = driveAwayDescriptor.getParameterDescriptors()
        .get( 0 );

    //The "speed" parameter is located at index 0, has one constraint and is not cascaded
    //nor does it define group conversions
    assertEquals( "arg0", speedDescriptor.getName() );
    assertEquals( 0, speedDescriptor.getIndex() );
    assertEquals( 1, speedDescriptor.getConstraintDescriptors().size() );
    assertFalse( speedDescriptor.isCascaded() );
    assert speedDescriptor.getGroupConversions().isEmpty();

    //getDriver() has no constrained parameters but its return value is marked for cascaded
    //validation and declares one group conversion
    MethodDescriptor getDriverDescriptor = carDescriptor.getConstraintsForMethod(
        "getDriver"
View Full Code Here

      }
    }
    else {
      // add the parameter descriptor
      Integer parameterIndex = localContext.getParameterIndex();
      ParameterDescriptor parameterDescriptor = executableDescriptor.getParameterDescriptors()
          .get( parameterIndex );
      elementDescriptors.add( parameterDescriptor );

      value = parameterValues[localContext.getParameterIndex()];
View Full Code Here

TOP

Related Classes of javax.validation.metadata.ParameterDescriptor

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.