Package org.hibernate.reflection

Examples of org.hibernate.reflection.XMember


          new Field( CLASS_FIELDNAME, instanceClass.getName(), Field.Store.YES, Field.Index.UN_TOKENIZED );
      doc.add( classField );
      idBridge.set( idKeywordName, id, doc, Field.Store.YES, Field.Index.UN_TOKENIZED, idBoost );
    }
    for ( int i = 0; i < keywordNames.size(); i++ ) {
      XMember member = keywordGetters.get( i );
      Object value = getMemberValue( instance, member );
      keywordBridges.get( i ).set(
          keywordNames.get( i ), value, doc, Field.Store.YES,
          Field.Index.UN_TOKENIZED, getBoost( member )
      );
    }
    for ( int i = 0; i < textNames.size(); i++ ) {
      XMember member = textGetters.get( i );
      Object value = getMemberValue( instance, member );
      textBridges.get( i ).set(
          textNames.get( i ), value, doc, Field.Store.YES,
          Field.Index.TOKENIZED, getBoost( member )
      );
    }
    for ( int i = 0; i < unstoredNames.size(); i++ ) {
      XMember member = unstoredGetters.get( i );
      Object value = getMemberValue( instance, member );
      unstoredBridges.get( i ).set(
          unstoredNames.get( i ), value, doc, Field.Store.NO,
          Field.Index.TOKENIZED, getBoost( member )
      );
    }
    for ( int i = 0; i < fieldNames.size(); i++ ) {
      XMember member = fieldGetters.get( i );
      Object value = getMemberValue( instance, member );
      fieldBridges.get( i ).set(
          fieldNames.get( i ), value, doc, fieldStore.get( i ),
          fieldIndex.get( i ), getBoost( member )
      );
View Full Code Here


        results.add( new InvalidValue( interpolate(validator), beanClass, null, bean, bean ) );
      }
    }

    for ( int i = 0; i < memberValidators.size() ; i++ ) {
      XMember getter = memberGetters.get( i );
      if ( Hibernate.isPropertyInitialized( bean, getPropertyName( getter ) ) ) {
        Object value = getMemberValue( bean, getter );
        Validator validator = memberValidators.get( i );
        if ( !validator.isValid( value ) ) {
          String propertyName = getPropertyName( getter );
          results.add( new InvalidValue( interpolate(validator), beanClass, propertyName, value, bean ) );
        }
      }
    }

    for ( int i = 0; i < childGetters.size() ; i++ ) {
      XMember getter = childGetters.get( i );
      if ( Hibernate.isPropertyInitialized( bean, getPropertyName( getter ) ) ) {
        Object value = getMemberValue( bean, getter );
        if ( value != null && Hibernate.isInitialized( value ) ) {
          String propertyName = getPropertyName( getter );
          if ( getter.isCollection() ) {
            int index = 0;
            boolean isIterable = value instanceof Iterable;
            Map map = ! isIterable ? (Map) value : null;
            Iterable elements = isIterable ?
                (Iterable) value :
                map.keySet();
            for ( Object element : elements ) {
              Object actualElement = isIterable ? element : map.get( element );
              if ( actualElement == null ) {
                index++;
                continue;
              }
              InvalidValue[] invalidValues = getClassValidator( actualElement )
                  .getInvalidValues( actualElement, circularityState );

              String indexedPropName = MessageFormat.format(
                  "{0}[{1}]",
                  propertyName,
                  INDEXABLE_CLASS.contains( element.getClass() ) ?
                      ( "'" + element + "'" ) :
                      index
              );
              index++;

              for ( InvalidValue invalidValue : invalidValues ) {
                invalidValue.addParentBean( bean, indexedPropName );
                results.add( invalidValue );
              }
            }
          }
          if ( getter.isArray() ) {
            int index = 0;
            for ( Object element : (Object[]) value ) {
              if ( element == null ) {
                index++;
                continue;
View Full Code Here

  //TODO should it be recursive?
  public InvalidValue[] getInvalidValues(T bean, String propertyName) {
    List<InvalidValue> results = new ArrayList<InvalidValue>();

    for ( int i = 0; i < memberValidators.size() ; i++ ) {
      XMember getter = memberGetters.get( i );
      if ( getPropertyName( getter ).equals( propertyName ) ) {
        Object value = getMemberValue( bean, getter );
        Validator validator = memberValidators.get( i );
        if ( !validator.isValid( value ) ) {
          results.add( new InvalidValue( interpolate(validator), beanClass, propertyName, value, bean ) );
View Full Code Here

  //TODO should it be recursive?
  public InvalidValue[] getPotentialInvalidValues(String propertyName, Object value) {
    List<InvalidValue> results = new ArrayList<InvalidValue>();

    for ( int i = 0; i < memberValidators.size() ; i++ ) {
      XMember getter = memberGetters.get( i );
      if ( getPropertyName( getter ).equals( propertyName ) ) {
        Validator validator = memberValidators.get( i );
        if ( !validator.isValid( value ) ) {
          results.add( new InvalidValue( interpolate(validator), beanClass, propertyName, value, null ) );
        }
View Full Code Here

TOP

Related Classes of org.hibernate.reflection.XMember

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.