Package org.hibernate.property

Examples of org.hibernate.property.Getter


    }

    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


           throw new MappingException(String.format("Unable to create AuditStrategy[%s] instance." , auditEntCfg.getAuditStrategyName()));
        }

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

        return strategy;
  }
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 boolean mapToEntityFromMap(Object obj, Map data) {
        if (data == null || obj == null) {
            return false;
        }

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

        try {
            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;
        }

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

    mappings = new Configuration().createMappings();
  }

  public void testStringElementExtraction() throws Throwable {
    Property property = generateNameProperty();
    Getter getter = PropertyAccessorFactory.getPropertyAccessor( property, EntityMode.DOM4J )
        .getGetter( null, null );
    String name = ( String ) getter.get( DOM );
    assertEquals( "Not equals", "JBoss", name );
  }
View Full Code Here

    assertEquals( "Not equals", "JBoss", name );
  }

  public void testStringTextExtraction() throws Throwable {
    Property property = generateTextProperty();
    Getter getter = PropertyAccessorFactory.getPropertyAccessor( property, EntityMode.DOM4J )
        .getGetter( null, null );
    String name = ( String ) getter.get( DOM );
    assertEquals( "Not equals", "description...", name );
  }
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.