Package org.hibernate.validator.internal.engine.path

Examples of org.hibernate.validator.internal.engine.path.PathImpl


    if ( ElementType.TYPE.equals( metaConstraint.getElementType() ) ) {
      return true;
    }

    boolean isReachable;
    PathImpl path = valueContext.getPropertyPath();
    Path pathToObject = path.getPathWithoutLeafNode();

    try {
      isReachable = validationContext.getTraversableResolver().isReachable(
          valueContext.getCurrentBean(),
          path.getLeafNode(),
          validationContext.getRootBeanClass(),
          pathToObject,
          metaConstraint.getElementType()
      );
    }
View Full Code Here


  private boolean isCascadeRequired(ValidationContext<?, ?> validationContext, ValueContext<?, ?> valueContext, ElementType type) {
    boolean isReachable;
    boolean isCascadable;

    PathImpl path = valueContext.getPropertyPath();
    Path pathToObject = path.getPathWithoutLeafNode();

    // HV-524 - class level constraints are reachable
    if ( ElementType.TYPE.equals( type ) ) {
      isReachable = true;
    }
    else {
      try {
        isReachable = validationContext.getTraversableResolver().isReachable(
            valueContext.getCurrentBean(),
            path.getLeafNode(),
            validationContext.getRootBeanClass(),
            pathToObject,
            type
        );
      }
      catch ( RuntimeException e ) {
        throw log.getErrorDuringCallOfTraversableResolverIsReachableException( e );
      }
    }

    if ( ElementType.TYPE.equals( type ) ) {
      isCascadable = true;
    }
    else {
      try {
        isCascadable = validationContext.getTraversableResolver().isCascadable(
            valueContext.getCurrentBean(),
            path.getLeafNode(),
            validationContext.getRootBeanClass(),
            pathToObject,
            type
        );
      }
View Full Code Here

      // if the current class redefined the default group sequence, this sequence has to be applied to all the class hierarchy.
      if ( defaultGroupSequenceIsRedefined ) {
        metaConstraints = hostingBeanMetaData.getMetaConstraints();
      }

      PathImpl currentPath = valueContext.getPropertyPath();
      for ( Class<?> defaultSequenceMember : defaultGroupSequence ) {
        valueContext.setCurrentGroup( defaultSequenceMember );
        boolean validationSuccessful = true;
        for ( MetaConstraint<?> metaConstraint : metaConstraints ) {
          // HV-466, an interface implemented more than one time in the hierarchy has to be validated only one
View Full Code Here

    }
  }

  private void validateConstraintsForNonDefaultGroup(ValidationContext<?> validationContext, ValueContext<?, Object> valueContext) {
    BeanMetaData<?> beanMetaData = beanMetaDataManager.getBeanMetaData( valueContext.getCurrentBeanType() );
    PathImpl currentPath = valueContext.getPropertyPath();
    for ( MetaConstraint<?> metaConstraint : beanMetaData.getMetaConstraints() ) {
      validateConstraint( validationContext, valueContext, false, metaConstraint );
      if ( shouldFailFast( validationContext ) ) {
        return;
      }
View Full Code Here

   * @param valueContext Collected information for single validation
   */
  @SuppressWarnings( "unchecked" )
  private void validateCascadedConstraints(ValidationContext<?> validationContext, ValueContext valueContext) {
    Validatable validatable = valueContext.getCurrentValidatable();
    PathImpl originalPath = valueContext.getPropertyPath();
    Class<?> originalGroup = valueContext.getCurrentGroup();

    for ( Cascadable cascadable : validatable.getCascadables() ) {
      valueContext.appendNode( cascadable );
      Class<?> group = cascadable.convertGroup( originalGroup );
View Full Code Here

      );
      valueContext.setCurrentValidatedValue( parameterValues );

      // 2. validate parameter constraints
      for ( int i = 0; i < parameterValues.length; i++ ) {
        PathImpl originalPath = valueContext.getPropertyPath();

        ParameterMetaData parameterMetaData = executableMetaData.getParameterMetaData( i );
        Object value = parameterValues[i];

        if ( value != null ) {
View Full Code Here

    assertEquals( path.toString(), property );
  }

  @Test
  public void testParsingPropertyWithCurrencySymbol() {
    PathImpl path = PathImpl.createPathFromString( "€Amount" );
    Iterator<Path.Node> it = path.iterator();

    assertEquals( it.next().getName(), "€Amount" );
  }
View Full Code Here

    assertEquals( it.next().getName(), "€Amount" );
  }

  @Test
  public void testParsingPropertyWithGermanCharacter() {
    PathImpl path = PathImpl.createPathFromString( "höchstBetrag" );
    Iterator<Path.Node> it = path.iterator();

    assertEquals( it.next().getName(), "höchstBetrag" );
  }
View Full Code Here

    assertEquals( it.next().getName(), "höchstBetrag" );
  }

  @Test
  public void testParsingPropertyWithUnicodeCharacter() {
    PathImpl path = PathImpl.createPathFromString( "höchst\u00f6Betrag" );
    Iterator<Path.Node> it = path.iterator();

    assertEquals( it.next().getName(), "höchst\u00f6Betrag" );
  }
View Full Code Here

    );

    ExecutableMetaData executableMetaData = beanMetaDataManager.getBeanMetaData( Container.class )
        .getMetaDataFor( executable );

    PathImpl methodParameterPath = PathImpl.createPathForExecutable( executableMetaData );

    assertEquals( methodParameterPath.toString(), "addItem" );
  }
View Full Code Here

TOP

Related Classes of org.hibernate.validator.internal.engine.path.PathImpl

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.