Package org.hibernate.property

Examples of org.hibernate.property.Getter


    Class clazz = bean.getClass();
    String[] params = getNamedParameters();
    for (int i = 0; i < params.length; i++) {
      String namedParam = params[i];
      try {
        Getter getter = ReflectHelper.getGetter( clazz, namedParam );
        Class retType = getter.getReturnType();
        final Object object = getter.get( bean );
        if ( Collection.class.isAssignableFrom( retType ) ) {
          setParameterList( namedParam, ( Collection ) object );
        }
        else if ( retType.isArray() ) {
           setParameterList( namedParam, ( Object[] ) object );
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

      );
    }

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

    return strategy;
  }
View Full Code Here

    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

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.