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

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


      List<MetaConstraint<?>> metaConstraintsList) {
    Class<?> clazz = validationContext.getRootBeanClass();
    Object value = validationContext.getRootBean();

    // cast is ok, since we are dealing with engine internal classes
    NodeImpl elem = (NodeImpl) propertyIter.next();
    Object newValue = value;

    BeanMetaData<?> metaData = beanMetaDataManager.getBeanMetaData( clazz );
    PropertyMetaData property = metaData.getMetaDataFor( elem.getName() );

    // use precomputed method list as ReflectionHelper#containsMember is slow
    if ( property == null ) {
      throw log.getInvalidPropertyPathException( elem.getName(), metaData.getBeanClass().getName() );
    }
    else if ( !propertyIter.hasNext() ) {
      metaConstraintsList.addAll( property.getConstraints() );
    }
    else {
      if ( property.isCascading() ) {
        Type type = property.getType();
        newValue = newValue == null ? null : getValue( newValue, validationContext, property );
        if ( elem.isIterable() ) {
          if ( newValue != null && elem.getIndex() != null ) {
            newValue = ReflectionHelper.getIndexedValue( newValue, elem.getIndex() );
          }
          else if ( newValue != null && elem.getKey() != null ) {
            newValue = ReflectionHelper.getMappedValue( newValue, elem.getKey() );
          }
          else if ( newValue != null ) {
            throw log.getPropertyPathMustProvideIndexOrMapKeyException();
          }
          type = ReflectionHelper.getIndexedType( type );
View Full Code Here


   *
   * @return Returns an instance of {@code ValueContext} which describes the local validation context associated to the given property path.
   */
  private <V> ValueContext<?, V> collectMetaConstraintsForPath(Class<?> clazz, Object value, Iterator<Path.Node> propertyIter, PathImpl propertyPath, List<MetaConstraint<?>> metaConstraintsList) {
    // cast is ok, since we are dealing with engine internal classes
    NodeImpl elem = (NodeImpl) propertyIter.next();
    Object newValue = value;

    BeanMetaData<?> metaData = beanMetaDataManager.getBeanMetaData( clazz );
    PropertyMetaData property = metaData.getMetaDataFor( elem.getName() );

    // use precomputed method list as ReflectionHelper#containsMember is slow
    if ( property == null ) {
      throw log.getInvalidPropertyPathException( elem.getName(), metaData.getBeanClass().getName() );
    }
    else if ( !propertyIter.hasNext() ) {
      metaConstraintsList.addAll( property.getConstraints() );
    }
    else {
      if ( property.isCascading() ) {
        Type type = property.getType();
        newValue = newValue == null ? null : getValue( newValue, property );
        if ( elem.isIterable() ) {
          if ( newValue != null && elem.getIndex() != null ) {
            newValue = ReflectionHelper.getIndexedValue( newValue, elem.getIndex() );
          }
          else if ( newValue != null && elem.getKey() != null ) {
            newValue = ReflectionHelper.getMappedValue( newValue, elem.getKey() );
          }
          else if ( newValue != null ) {
            throw log.getPropertyPathMustProvideIndexOrMapKeyException();
          }
          type = ReflectionHelper.getIndexedType( type );
View Full Code Here

   *
   * @return Returns an instance of {@code ValueContext} which describes the local validation context associated to the given property path.
   */
  private <V> ValueContext<?, V> collectMetaConstraintsForPath(Class<?> clazz, Object value, Iterator<Path.Node> propertyIter, PathImpl propertyPath, List<MetaConstraint<?>> metaConstraintsList) {
    // cast is ok, since we are dealing with engine internal classes
    NodeImpl elem = (NodeImpl) propertyIter.next();
    Object newValue = value;

    BeanMetaData<?> metaData = beanMetaDataManager.getBeanMetaData( clazz );
    PropertyMetaData property = metaData.getMetaDataFor( elem.getName() );

    // use precomputed method list as ReflectionHelper#containsMember is slow
    if ( property == null ) {
      throw log.getInvalidPropertyPathException( elem.getName(), metaData.getBeanClass().getName() );
    }
    else if ( !propertyIter.hasNext() ) {
      metaConstraintsList.addAll( property.getConstraints() );
    }
    else {
      if ( property.isCascading() ) {
        Type type = property.getType();
        newValue = newValue == null ? null : property.getValue(
            newValue
        );
        if ( elem.isIterable() ) {
          if ( newValue != null && elem.getIndex() != null ) {
            newValue = ReflectionHelper.getIndexedValue( newValue, elem.getIndex() );
          }
          else if ( newValue != null && elem.getKey() != null ) {
            newValue = ReflectionHelper.getMappedValue( newValue, elem.getKey() );
          }
          else if ( newValue != null ) {
            throw log.getPropertyPathMustProvideIndexOrMapKeyException();
          }
          type = ReflectionHelper.getIndexedType( type );
View Full Code Here

   *
   * @return Returns an instance of {@code ValueContext} which describes the local validation context associated to the given property path.
   */
  private <V> ValueContext<?, V> collectMetaConstraintsForPath(Class<?> clazz, Object value, Iterator<Path.Node> propertyIter, PathImpl propertyPath, List<MetaConstraint<?>> metaConstraintsList) {
    // cast is ok, since we are dealing with engine internal classes
    NodeImpl elem = (NodeImpl) propertyIter.next();
    Object newValue = value;

    BeanMetaData<?> metaData = beanMetaDataManager.getBeanMetaData( clazz );
    PropertyMetaData property = metaData.getMetaDataFor( elem.getName() );

    // use precomputed method list as ReflectionHelper#containsMember is slow
    if ( property == null ) {
      throw log.getInvalidPropertyPathException( elem.getName(), metaData.getBeanClass().getName() );
    }
    else if ( !propertyIter.hasNext() ) {
      metaConstraintsList.addAll( property.getConstraints() );
    }
    else {
      if ( property.isCascading() ) {
        Type type = property.getType();
        newValue = newValue == null ? null : property.getValue(
            newValue
        );
        if ( elem.isIterable() ) {
          if ( newValue != null && elem.getIndex() != null ) {
            newValue = ReflectionHelper.getIndexedValue( newValue, elem.getIndex() );
          }
          else if ( newValue != null && elem.getKey() != null ) {
            newValue = ReflectionHelper.getMappedValue( newValue, elem.getKey() );
          }
          else if ( newValue != null ) {
            throw log.getPropertyPathMustProvideIndexOrMapKeyException();
          }
          type = ReflectionHelper.getIndexedType( type );
View Full Code Here

TOP

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

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.