Package org.hibernate.property

Examples of org.hibernate.property.Getter


    return getGetter( cls, propertyData.getBeanName(), propertyData.getAccessType() );
  }

  public static Getter getGetter(Class cls, String propertyName, String accessorType) {
    final Pair<Class, String> key = Pair.make( cls, propertyName );
    Getter value = GETTER_CACHE.get( key );
    if ( value == null ) {
      value = getAccessor( accessorType ).getGetter( cls, propertyName );
      // It's ok if two getters are generated concurrently
      GETTER_CACHE.put( key, value );
    }
View Full Code Here


  public void mapToMapFromEntity(Map<String, Object> data, Object obj) {
    if ( obj == null ) {
      return;
    }

    final Getter getter = ReflectionTools.getGetter( obj.getClass(), idPropertyData );
    mapToMapFromId( data, getter.get( obj ) );
  }
View Full Code Here

  public boolean mapToEntityFromMap(Object obj, Map data) {
    if ( data == null || obj == null ) {
      return false;
    }

    final Getter getter = ReflectionTools.getGetter( obj.getClass(), idPropertyData );
    final Setter setter = ReflectionTools.getSetter( obj.getClass(), idPropertyData );

    try {
      final Object subObj = ReflectHelper.getDefaultConstructor( getter.getReturnType() ).newInstance();

      boolean ret = true;
      for ( IdMapper idMapper : ids.values() ) {
        ret &= idMapper.mapToEntityFromMap( subObj, data );
      }
View Full Code Here

  public Object mapToIdFromEntity(Object data) {
    if ( data == null ) {
      return null;
    }

    final Getter getter = ReflectionTools.getGetter( data.getClass(), idPropertyData );
    return getter.get( data );
  }
View Full Code Here

      Map<String, Object> data,
      Object newObj,
      Object oldObj) {
    boolean ret = false;
    for ( PropertyData propertyData : properties.keySet() ) {
      Getter getter;
      if ( newObj != null ) {
        getter = ReflectionTools.getGetter( newObj.getClass(), propertyData );
      }
      else if ( oldObj != null ) {
        getter = ReflectionTools.getGetter( oldObj.getClass(), propertyData );
      }
      else {
        return false;
      }

      ret |= properties.get( propertyData ).mapToMapFromEntity(
          session, data,
          newObj == null ? null : getter.get( newObj ),
          oldObj == null ? null : getter.get( oldObj )
      );
    }

    return ret;
  }
View Full Code Here

      SessionImplementor session,
      Map<String, Object> data,
      Object newObj,
      Object oldObj) {
    for ( PropertyData propertyData : properties.keySet() ) {
      Getter getter;
      if ( newObj != null ) {
        getter = ReflectionTools.getGetter( newObj.getClass(), propertyData );
      }
      else if ( oldObj != null ) {
        getter = ReflectionTools.getGetter( oldObj.getClass(), propertyData );
      }
      else {
        return;
      }

      properties.get( propertyData ).mapModifiedFlagsToMapFromEntity(
          session, data,
          newObj == null ? null : getter.get( newObj ),
          oldObj == null ? null : getter.get( oldObj )
      );
    }
  }
View Full Code Here

    if ( data instanceof HibernateProxy ) {
      final HibernateProxy hibernateProxy = (HibernateProxy) data;
      return hibernateProxy.getHibernateLazyInitializer().getIdentifier();
    }
    else {
      final Getter getter = ReflectionTools.getGetter( data.getClass(), propertyData );
      return getter.get( data );
    }
  }
View Full Code Here

      if ( obj instanceof HibernateProxy ) {
        final HibernateProxy hibernateProxy = (HibernateProxy) obj;
        data.put( propertyData.getName(), hibernateProxy.getHibernateLazyInitializer().getIdentifier() );
      }
      else {
        final Getter getter = ReflectionTools.getGetter( obj.getClass(), propertyData );
        data.put( propertyData.getName(), getter.get( obj ) );
      }
    }
  }
View Full Code Here

  public void mapToEntityFromEntity(Object objTo, Object objFrom) {
    if ( objTo == null || objFrom == null ) {
      return;
    }

    final Getter getter = ReflectionTools.getGetter( objFrom.getClass(), propertyData );
    final Setter setter = ReflectionTools.getSetter( objTo.getClass(), propertyData );
    setter.set( objTo, getter.get( objFrom ), null );
  }
View Full Code Here

      );
    }

    if ( strategy instanceof ValidityAuditStrategy ) {
      // further initialization required
      final Getter revisionTimestampGetter = ReflectionTools.getGetter( revisionInfoClass, revisionInfoTimestampData );
      ( (ValidityAuditStrategy) strategy ).setRevisionTimestampGetter( revisionTimestampGetter );
    }

    return strategy;
  }
View Full Code Here

TOP

Related Classes of org.hibernate.property.Getter

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.