Package javax.validation.Path

Examples of javax.validation.Path.Node


    public String toString() {
      StringBuilder builder = new StringBuilder();
      Iterator<Path.Node> iter = iterator();
      boolean first = true;
      while ( iter.hasNext() ) {
        Node node = iter.next();
        if ( node.isInIterable() ) {
          appendIndex( builder, node );
        }
        if ( node.getName() != null ) {
          if ( !first ) {
            builder.append( PROPERTY_PATH_SEPARATOR );
          }
          builder.append( node.getName() );
        }
        first = false;
      }
      return builder.toString();
    }
View Full Code Here


         throw new RuntimeException("unknown object passed as constraint violation: " + o);
      }
      ConstraintViolation<?> v = ConstraintViolation.class.cast(o);
     
      Iterator<Node> nodes = v.getPropertyPath().iterator();
      Node firstNode = nodes.next();
      if (firstNode.getKind() == ElementKind.METHOD)
      {
         Node secondNode = nodes.next();
        
         if (secondNode.getKind() == ElementKind.PARAMETER ||
             secondNode.getKind() == ElementKind.CROSS_PARAMETER)
         {
            return ConstraintType.Type.PARAMETER;
         }
         else if (secondNode.getKind() == ElementKind.RETURN_VALUE)
         {
            return ConstraintType.Type.RETURN_VALUE;
         }
         else
         {
            throw new RuntimeException("unexpected path node type in method violation: " + secondNode.getKind());
         }
      }

      if (firstNode.getKind() == ElementKind.BEAN)
      {
View Full Code Here

    Iterator<Node> it = this.iterator();
   
    int index = 0;
   
    while(it.hasNext()) {
      Node node = it.next();
     
      if(index != 0 && node.getKey() == null && node.getIndex() == null) {
        builder.append(".");
      }
      builder.append(node.toString());
   
      index++;
    }
   
    return builder.toString();
View Full Code Here

      Object b = v.getRootBean();
      String fieldName = null;
      Iterator<Node>it = v.getPropertyPath().iterator();
      while (it.hasNext())
      {
         Node node = it.next();
         fieldName = node.getName();
         if (fieldName == null)
         {
            return Type.CLASS;
         }
      }
View Full Code Here

   * Returns the category for this constraint violation. By default, the category returned
   * is the full path for property. You can override this method if you prefer another strategy.
   */
  protected String extractCategory(ValuedParameter[] params, ConstraintViolation<Object> violation) {
    Iterator<Node> path = violation.getPropertyPath().iterator();
    Node method = path.next();
    logger.debug("Constraint violation on method {}: {}", method, violation);

    StringBuilder cat = new StringBuilder();
    cat.append(params[path.next().as(ParameterNode.class).getParameterIndex()].getName());// parameter name

View Full Code Here

   * Returns the category for this constraint violation. By default, the category returned
   * is the full path for property. You can override this method if you prefer another strategy.
   */
  protected String extractCategory(ValuedParameter[] params, ConstraintViolation<Object> violation) {
    Iterator<Node> path = violation.getPropertyPath().iterator();
    Node method = path.next();
    logger.debug("Constraint violation on method {}: {}", method, violation);

    StringBuilder cat = new StringBuilder();
    cat.append(params[path.next().as(ParameterNode.class).getParameterIndex()].getName());// parameter name

View Full Code Here

TOP

Related Classes of javax.validation.Path.Node

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.