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

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


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


    );
  }

  @Test
  public void locallyDefinedGroupConversion() {
    PropertyMetaData property = beanMetaDataManager.getBeanMetaData( User1.class ).getMetaDataFor( "addresses" );

    assertThat( property.convertGroup( Default.class ) ).isEqualTo( BasicPostal.class );
  }
View Full Code Here

    assertThat( property.convertGroup( Default.class ) ).isEqualTo( BasicPostal.class );
  }

  @Test
  public void groupConversionDefinedInHierarchy() {
    PropertyMetaData property = beanMetaDataManager.getBeanMetaData( User2.class ).getMetaDataFor( "addresses" );

    assertThat( property.convertGroup( Default.class ) ).isEqualTo( BasicPostal.class );
  }
View Full Code Here

    beanMetaDataManager.getBeanMetaData( User3.class ).getMetaDataFor( "addresses" );
  }

  @Test
  public void unwrapValidatedValueGivenOnField() {
    PropertyMetaData property = beanMetaDataManager.getBeanMetaData( Customer.class ).getMetaDataFor( "name" );
    assertEquals( property.unwrapMode(), UnwrapMode.UNWRAP );

    property = beanMetaDataManager.getBeanMetaData( Customer.class ).getMetaDataFor( "age" );
    assertEquals( property.unwrapMode(), UnwrapMode.AUTOMATIC );
  }
View Full Code Here

    assertEquals( property.unwrapMode(), UnwrapMode.AUTOMATIC );
  }

  @Test
  public void unwrapValidatedValueGivenOnProperty() {
    PropertyMetaData property = beanMetaDataManager.getBeanMetaData( Customer.class ).getMetaDataFor( "firstName" );
    assertEquals( property.unwrapMode(), UnwrapMode.UNWRAP );
  }
View Full Code Here

    assertEquals( property.unwrapMode(), UnwrapMode.UNWRAP );
  }

  @Test
  public void unwrapValidatedValueGivenOnPropertyInSuperClass() {
    PropertyMetaData property = beanMetaDataManager.getBeanMetaData( RetailCustomer.class )
        .getMetaDataFor( "firstName" );
    assertEquals( property.unwrapMode(), UnwrapMode.UNWRAP );
  }
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

    // 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() );
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() )
      );

      valueContext.appendNode( propertyMetaData );
      setValidatedValueHandlerToValueContextIfPresent( validationContext, valueContext, propertyMetaData );
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 : property.getValue(
            newValue
        );
        if ( elem.isIterable() ) {
          if ( newValue != null && elem.getIndex() != null ) {
            newValue = ReflectionHelper.getIndexedValue( newValue, elem.getIndex() );
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.