Package javax.validation.Path

Examples of javax.validation.Path.ParameterNode


    );

    assertTrue( nodeIter.hasNext() );
    nextNode = nodeIter.next();
    assertNode( nextNode, "arg0", ElementKind.PARAMETER, false, null, null );
    ParameterNode parameterNode = nextNode.as( ParameterNode.class );
    assertNotNull( parameterNode );
    assertEquals( parameterNode.getParameterIndex(), 0 );

    assertFalse( nodeIter.hasNext() );

    //parameter 1
    nodeIter = getConstraintViolationForParameter( constraintViolations, "arg1" ).getPropertyPath().iterator();

    assertTrue( nodeIter.hasNext() );
    assertNode( nodeIter.next(), methodName, ElementKind.METHOD, false, null, null );

    assertTrue( nodeIter.hasNext() );
    nextNode = nodeIter.next();
    assertNode( nextNode, "arg1", ElementKind.PARAMETER, false, null, null );
    parameterNode = nextNode.as( ParameterNode.class );
    assertNotNull( parameterNode );
    assertEquals( parameterNode.getParameterIndex(), 1 );

    assertFalse( nodeIter.hasNext() );
  }
View Full Code Here


    assertEquals( constructorNode.getParameterTypes(), Arrays.<Class<?>>asList( String.class, Person.class ) );

    assertTrue( nodeIter.hasNext() );
    nextNode = nodeIter.next();
    assertNode( nextNode, "arg0", ElementKind.PARAMETER, false, null, null );
    ParameterNode parameterNode = nextNode.as( ParameterNode.class );
    assertNotNull( parameterNode );
    assertEquals( parameterNode.getParameterIndex(), 0 );

    assertFalse( nodeIter.hasNext() );

    //parameter 1
    nodeIter = getConstraintViolationForParameter( constraintViolations, "arg1" ).getPropertyPath().iterator();

    assertTrue( nodeIter.hasNext() );
    assertNode( nodeIter.next(), "MovieStudio", ElementKind.CONSTRUCTOR, false, null, null );

    assertTrue( nodeIter.hasNext() );
    nextNode = nodeIter.next();
    assertNode( nextNode, "arg1", ElementKind.PARAMETER, false, null, null );
    parameterNode = nextNode.as( ParameterNode.class );
    assertNotNull( parameterNode );
    assertEquals( parameterNode.getParameterIndex(), 1 );

    assertFalse( nodeIter.hasNext() );
  }
View Full Code Here

   * change this behaviour.
   */
  protected String extractCategory(Parameter[] params, ConstraintViolation<Object> v) {
    Iterator<Node> property = v.getPropertyPath().iterator();
    property.next();
    ParameterNode parameterNode = property.next().as(ParameterNode.class);

    int index = parameterNode.getParameterIndex();
    return Joiner.on(".").join(v.getPropertyPath())
        .replace("arg" + parameterNode.getParameterIndex(), params[index].getName());
  }
View Full Code Here

   * change this behaviour.
   */
  protected String extractCategory(String[] names, ConstraintViolation<Object> v) {
    Iterator<Node> property = v.getPropertyPath().iterator();
    property.next();
    ParameterNode parameterNode = property.next().as(ParameterNode.class);

    int index = parameterNode.getParameterIndex();
    return Joiner.on(".").join(v.getPropertyPath())
        .replace("arg" + parameterNode.getParameterIndex(), names[index]);
  }
View Full Code Here

   * change this behaviour.
   */
  protected String extractCategory(String[] names, ConstraintViolation<Object> v) {
    Iterator<Node> property = v.getPropertyPath().iterator();
    property.next();
    ParameterNode parameterNode = property.next().as(ParameterNode.class);

    int index = parameterNode.getParameterIndex();
    return Joiner.on(".").join(v.getPropertyPath())
        .replace("arg" + parameterNode.getParameterIndex(), names[index]);
  }
View Full Code Here

    Iterator<Path.Node> nodeIterator = constraintViolation.getPropertyPath().iterator();

    // first node is method descriptor
    nodeIterator.next();
    Path.Node node = nodeIterator.next();
    ParameterNode parameterNode = node.as( ParameterNode.class );
    assertEquals( parameterNode.getParameterIndex(), index.intValue() );
  }
View Full Code Here

    MethodNode methodNode = propertyPath.next().as( MethodNode.class );
    assertEquals( "drive", methodNode.getName() );
    assertEquals( Arrays.<Class<?>>asList( int.class ), methodNode.getParameterTypes() );

    ParameterNode parameterNode = propertyPath.next().as( ParameterNode.class );
    assertEquals( "arg0", parameterNode.getName() );
    assertEquals( 0, parameterNode.getParameterIndex() );
  }
View Full Code Here

TOP

Related Classes of javax.validation.Path.ParameterNode

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.