Package javax.validation.metadata

Examples of javax.validation.metadata.ElementDescriptor


    Validator validator = getValidatorUnderTest();
    return validator.getConstraintsForClass( clazz ).getConstraintsForProperty( property );
  }

  public static Set<ConstraintDescriptor<?>> getConstraintDescriptorsFor(Class<?> clazz, String property) {
    ElementDescriptor elementDescriptor = getPropertyDescriptor( clazz, property );
    return elementDescriptor.getConstraintDescriptors();
  }
View Full Code Here


  }

  @Test
  @SpecAssertion(section = "5.2", id = "b")
  public void testGetConstraintDescriptors() {
    ElementDescriptor descriptor = getPropertyDescriptor( SubClass.class, "myField" );
    assertEquals( descriptor.getConstraintDescriptors().size(), 2, "There should be two constraints on myField" );
  }
View Full Code Here

  }

  @Test
  @SpecAssertion(section = "5.2", id = "c")
  public void testHasConstraints() {
    ElementDescriptor descriptor = getPropertyDescriptor( SubClass.class, "myField" );
    assertTrue( descriptor.hasConstraints() );
  }
View Full Code Here

    Validator validator = getValidatorUnderTest();
    return validator.getConstraintsForClass( clazz ).getConstraintsForProperty( property );
  }

  public static Set<ConstraintDescriptor<?>> getConstraintDescriptorsFor(Class<?> clazz, String property) {
    ElementDescriptor elementDescriptor = getPropertyDescriptor( clazz, property );
    return elementDescriptor.getConstraintDescriptors();
  }
View Full Code Here

    message.append( Arrays.toString( args ) );
    message.append( "\nConstraint violations: " );

    int i = 1;
    for ( ConstraintViolation<?> constraintViolation : violations ) {
      ElementDescriptor elementDescriptor = locateElementDescriptor( constraintViolation );

      message.append( "\n (" );
      message.append( i );
      message.append( ")" );
      if ( elementDescriptor != null ) {
        message.append( " Kind: " );
        message.append( elementDescriptor.getKind() );
        if ( elementDescriptor instanceof ParameterDescriptor ) {
          message.append( "\n parameter index: " );
          message.append( ( (ParameterDescriptor) elementDescriptor ).getIndex() );
        }
      }
View Full Code Here

  public void testGetElementClass() {
    Validator validator = getValidatorUnderTest();
    BeanDescriptor beanDescriptor = validator.getConstraintsForClass( SuperClass.class );
    assertEquals( beanDescriptor.getElementClass(), SuperClass.class, "Wrong element class" );

    ElementDescriptor elementDescriptor = beanDescriptor.getConstraintsForProperty( "myField" );
    assertEquals( elementDescriptor.getElementClass(), String.class, "Wrong element class" );
  }
View Full Code Here

  }

  @Test
  @SpecAssertion(section = "5.2", id = "b")
  public void testGetConstraintDescriptors() {
    ElementDescriptor descriptor = getPropertyDescriptor( SubClass.class, "myField" );
    assertEquals( descriptor.getConstraintDescriptors().size(), 2, "There should be two constraints on myField" );
  }
View Full Code Here

  }

  @Test
  @SpecAssertion(section = "5.2", id = "c")
  public void testHasConstraints() {
    ElementDescriptor descriptor = getPropertyDescriptor( SubClass.class, "myField" );
    assertTrue( descriptor.hasConstraints() );
  }
View Full Code Here

    Validator validator = getValidatorUnderTest();
    return validator.getConstraintsForClass( clazz ).getConstraintsForProperty( property );
  }

  public static Set<ConstraintDescriptor<?>> getConstraintDescriptorsFor(Class<?> clazz, String property) {
    ElementDescriptor elementDescriptor = getPropertyDescriptor( clazz, property );
    return elementDescriptor.getConstraintDescriptors();
  }
View Full Code Here

    Validator validator = getDefaultValidator();
    return validator.getConstraintsForClass( clazz ).getConstraintsForProperty( property );
  }

  public static Set<ConstraintDescriptor<?>> getConstraintDescriptorsFor(Class<?> clazz, String property) {
    ElementDescriptor elementDescriptor = getPropertyDescriptor( clazz, property );
    return elementDescriptor.getConstraintDescriptors();
  }
View Full Code Here

TOP

Related Classes of javax.validation.metadata.ElementDescriptor

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.