Package org.hibernate.property

Examples of org.hibernate.property.Getter


      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

    }

    public boolean mapToMapFromEntity(SessionImplementor session, 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

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

        } else {
            if(obj instanceof HibernateProxy) {
              HibernateProxy hibernateProxy = (HibernateProxy)obj;
              data.put(propertyData.getName(), hibernateProxy.getHibernateLazyInitializer().getIdentifier());
            } else {
              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;
        }

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

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

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

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

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

        try {
            Object subObj = ReflectHelper.getDefaultConstructor(getter.getReturnType()).newInstance();
            setter.set(obj, subObj, null);

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

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

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

  private void addSubElement(Property property, ValidatableElement element) {
    if ( property != null && property.isComposite() && ! property.isBackRef() ) {
      Component component = (Component) property.getValue();
      if ( component.isEmbedded() ) return;
      PropertyAccessor accessor = PropertyAccessorFactory.getPropertyAccessor( property, EntityMode.POJO );
      Getter getter = accessor.getGetter( element.clazz, property.getName() );
      ClassValidator validator = new ClassValidator( getter.getReturnType() );
      ValidatableElement subElement = new ValidatableElement( getter.getReturnType(), validator, getter );
      Iterator properties = component.getPropertyIterator();
      while ( properties.hasNext() ) {
        addSubElement( (Property) properties.next(), subElement );
      }
      if ( subElement.getSubElements().size() != 0 || subElement.validator.hasValidationRules() ) {
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.