Package org.hibernate.validator.internal.metadata.aggregated

Examples of org.hibernate.validator.internal.metadata.aggregated.PropertyMetaData$Builder


  private <T, U, V> ValueContext<U, V> collectMetaConstraintsForPath(Class<T> clazz, Object value, Iterator<Path.Node> propertyIter, PathImpl propertyPath, List<MetaConstraint<?>> metaConstraintsList) {
    Path.Node elem = 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.isInIterable() ) {
          if ( newValue != null && elem.getIndex() != null ) {
            newValue = ReflectionHelper.getIndexedValue( newValue, elem.getIndex() );
View Full Code Here


          throw log.getInvalidJavaIdentifierException( value );
        }

        // create the node
        if ( parentType != null ) {
          PropertyMetaData property = metaDataManager.getBeanMetaData( parentType ).getMetaDataFor( value );
          if ( property == null ) {
            throw log.getUnableToParsePropertyPathException( propertyName );
          }

          path.addNode( property.getName(), property.getDescriptor() );
          parentType = property.getRawType();
        }
        else {
          path.addNode( value );
        }
View Full Code Here

  private <T, U, V> ValueContext<U, V> collectMetaConstraintsForPath(Class<T> clazz, Object value, Iterator<Path.Node> propertyIter, PathImpl propertyPath, List<MetaConstraint<?>> metaConstraintsList) {
    Path.Node elem = 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.isInIterable() ) {
          if ( newValue != null && elem.getIndex() != null ) {
            newValue = ReflectionHelper.getIndexedValue( newValue, elem.getIndex() );
View Full Code Here

  private <V> ValueContext<?, V> collectMetaConstraintsForPath(Class<?> clazz, Object value, Iterator<Path.Node> propertyIter, PathImpl propertyPath, List<MetaConstraint<?>> metaConstraintsList) {
    Path.Node elem = 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.isInIterable() ) {
          if ( newValue != null && elem.getIndex() != null ) {
            newValue = ReflectionHelper.getIndexedValue( newValue, elem.getIndex() );
View Full Code Here

                     MetaConstraint<?> metaConstraint) {

    boolean validationSuccessful = true;

    if ( metaConstraint.getElementType() != ElementType.TYPE ) {
      PropertyMetaData propertyMetaData = beanMetaDataManager.getBeanMetaData( valueContext.getCurrentBeanType() ).getMetaDataFor(
        ReflectionHelper.getPropertyName( metaConstraint.getLocation().getMember() )
      );

      if ( !propertyPathComplete ) {
        valueContext.appendNode( propertyMetaData );
      }
      // set the unwrapping mode for this validation
      valueContext.setUnwrapMode( propertyMetaData.unwrapMode() );
    }
    else {
      valueContext.appendBeanNode();
    }
View Full Code Here

    // 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() );
          }
View Full Code Here

    while ( nodeIterator.hasNext() ) {
      Path.Node node = nodeIterator.next();
      BeanMetaData<?> beanMetaData = beanMetaDataManager.getBeanMetaData( currentClass );
      metaDataList.add( beanMetaData );

      PropertyMetaData property = beanMetaData.getMetaDataFor( node.getName() );

      if ( property != null && property.isCascading() ) {
        currentValue = property.getValue( currentValue );
        if ( currentValue != null ) {
          currentClass = currentValue.getClass();
          Iterator<?> iter = ReflectionHelper.createIteratorForCascadedValue(
              currentClass,
              currentValue
View Full Code Here

  private <T, U, V> ValueContext<U, V> collectMetaConstraintsForPath(Class<T> clazz, Object value, Iterator<Path.Node> propertyIter, PathImpl propertyPath, List<MetaConstraint<?>> metaConstraintsList) {
    Path.Node elem = 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.isInIterable() ) {
          if ( newValue != null && elem.getIndex() != null ) {
            newValue = ReflectionHelper.getIndexedValue( newValue, elem.getIndex() );
View Full Code Here

    while ( nodeIterator.hasNext() ) {
      Path.Node node = nodeIterator.next();
      BeanMetaData<?> beanMetaData = beanMetaDataManager.getBeanMetaData( currentClass );
      metaDataList.add( beanMetaData );

      PropertyMetaData property = beanMetaData.getMetaDataFor( node.getName() );

      if ( property != null && property.isCascading() ) {
        currentClass = property.getRawType();
        if ( ReflectionHelper.isIterable( currentClass ) ) {
          currentClass = (Class<?>) ReflectionHelper.getIndexedType( currentClass );
        }
      }
    }
View Full Code Here

                     MetaConstraint<?> metaConstraint) {

    boolean validationSuccessful = true;

    if ( metaConstraint.getElementType() != ElementType.TYPE ) {
      PropertyMetaData propertyMetaData = beanMetaDataManager.getBeanMetaData( valueContext.getCurrentBeanType() ).getMetaDataFor(
          ReflectionHelper.getPropertyName( metaConstraint.getLocation().getMember() )
      );

      if ( !propertyPathComplete ) {
        valueContext.appendNode( propertyMetaData );
View Full Code Here

TOP

Related Classes of org.hibernate.validator.internal.metadata.aggregated.PropertyMetaData$Builder

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.