db-ojb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From t...@apache.org
Subject cvs commit: db-ojb/src/java/org/apache/ojb/broker/metadata/fieldaccess PersistentNestedFieldMaxPerformanceImpl.java
Date Mon, 30 Jun 2003 21:15:10 GMT
thma        2003/06/30 14:15:10

  Modified:    src/java/org/apache/ojb/broker/metadata/fieldaccess
                        PersistentNestedFieldMaxPerformanceImpl.java
  Log:
  Make NestedFieldImpl pass all testcases
  
  Revision  Changes    Path
  1.8       +21 -12    db-ojb/src/java/org/apache/ojb/broker/metadata/fieldaccess/PersistentNestedFieldMaxPerformanceImpl.java
  
  Index: PersistentNestedFieldMaxPerformanceImpl.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/java/org/apache/ojb/broker/metadata/fieldaccess/PersistentNestedFieldMaxPerformanceImpl.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- PersistentNestedFieldMaxPerformanceImpl.java	2 May 2003 18:21:53 -0000	1.7
  +++ PersistentNestedFieldMaxPerformanceImpl.java	30 Jun 2003 21:15:10 -0000	1.8
  @@ -3,6 +3,7 @@
   import java.lang.reflect.Field;
   
   import org.apache.ojb.broker.metadata.MetadataException;
  +import org.apache.ojb.broker.util.ProxyHelper;
   
   /**
    *
  @@ -15,7 +16,7 @@
   {
       // private Logger logger = LoggerFactory.getLogger(PersistentNestedFieldMaxPerformanceImpl.class);
   
  -    public static final String PATH_TOKEN = "->";
  +    public static final String PATH_TOKEN = "::";
       private String m_fieldname;
   
       public PersistentNestedFieldMaxPerformanceImpl(Field f)
  @@ -100,8 +101,8 @@
           {
               String name = fieldName.substring(0, index);
               PersistentFieldMaxPerformanceImpl pField =
  -                    new PersistentFieldMaxPerformanceImpl(obj.getClass(), name);
  -            Object attrib = pField.get(obj);
  +                    new PersistentFieldMaxPerformanceImpl(ProxyHelper.getRealClass(obj),
name);
  +            Object attrib = pField.get(ProxyHelper.getRealObject(obj));
   
               if (attrib == null)
               {
  @@ -124,8 +125,11 @@
                               "Error getting field:" + name + " in object:" + obj.getClass().getName(),
                               e);
                   }
  -
  -                pField.set(obj, attrib);
  +                Class type = pField.getType();
  +				if ((value != null) || !type.isPrimitive())
  +				{
  +                	pField.set(ProxyHelper.getRealObject(obj), attrib);
  +				}
               }
               //
               String nestedName = fieldName.substring(index + PATH_TOKEN.length());
  @@ -136,8 +140,8 @@
           {
   
               PersistentFieldMaxPerformanceImpl pField =
  -                    new PersistentFieldMaxPerformanceImpl(obj.getClass(), fieldName);
  -            pField.set(obj, value);
  +                    new PersistentFieldMaxPerformanceImpl(ProxyHelper.getRealClass(obj),
fieldName);
  +            pField.set(ProxyHelper.getRealObject(obj), value);
           }
   
       }
  @@ -157,8 +161,8 @@
           {
               String name = fieldName.substring(0, index);
               PersistentFieldMaxPerformanceImpl pField =
  -                    new PersistentFieldMaxPerformanceImpl(obj.getClass(), name);
  -            Object attrib = pField.get(obj);
  +                    new PersistentFieldMaxPerformanceImpl(ProxyHelper.getRealClass(obj),
name);
  +            Object attrib = pField.get(ProxyHelper.getRealObject(obj));
   
               if (attrib != null)
               {
  @@ -171,8 +175,8 @@
           {
   
               PersistentFieldMaxPerformanceImpl pField =
  -                    new PersistentFieldMaxPerformanceImpl(obj.getClass(), fieldName);
  -            result = pField.get(obj);
  +                    new PersistentFieldMaxPerformanceImpl(ProxyHelper.getRealClass(obj),
fieldName);
  +            result = pField.get(ProxyHelper.getRealObject(obj));
           }
   
           return result;
  @@ -182,4 +186,9 @@
   	{
   		return false;
   	}
  +	
  +	 public String getName()
  +	 {
  +	 	return this.m_fieldname;	
  +	 }
   }
  
  
  

Mime
View raw message