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


    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

  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

    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

  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

    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

    }

    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

    }

  @Override
  public void mapModifiedFlagsToMapFromEntity(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 ( strategy instanceof ValidityAuditStrategy ) {
      // further initialization required
      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) {
        Pair<Class, String> key = make(cls, propertyName);
        Getter value = getterCache.get(key);
        if (value == null) {
            value = getAccessor(accessorType).getGetter(cls, propertyName);
            // It's ok if two getters are generated concurrently
            getterCache.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.