db-ojb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From b..@apache.org
Subject cvs commit: db-ojb/src/java/org/apache/ojb/broker/metadata ClassDescriptor.java
Date Fri, 01 Apr 2005 20:15:05 GMT
brj         2005/04/01 12:15:05

  Modified:    src/java/org/apache/ojb/broker/metadata ClassDescriptor.java
  Log:
  lookup fieldDescriptors in 'super' classDescriptor
  
  Revision  Changes    Path
  1.104     +29 -7     db-ojb/src/java/org/apache/ojb/broker/metadata/ClassDescriptor.java
  
  Index: ClassDescriptor.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/java/org/apache/ojb/broker/metadata/ClassDescriptor.java,v
  retrieving revision 1.103
  retrieving revision 1.104
  diff -u -r1.103 -r1.104
  --- ClassDescriptor.java	17 Mar 2005 21:34:53 -0000	1.103
  +++ ClassDescriptor.java	1 Apr 2005 20:15:05 -0000	1.104
  @@ -727,26 +727,48 @@
        */
       public FieldDescriptor getFieldDescriptorByName(String name)
       {
  -        if (name == null || m_FieldDescriptions == null)
  +        if (name == null)
           {
               return null;
           }
   
  +        FieldDescriptor fd  = (FieldDescriptor) getFieldDescriptorByNameMap().get(name);
  +
  +        // 
  +        // BRJ: if the FieldDescriptor is not found
  +        // look in the ClassDescriptor referenced by 'super' for it
  +        //
  +        if (fd == null)
  +        {
  +            ClassDescriptor superCld = getSuperClassDescriptor();
  +            if (superCld != null)
  +            {
  +                fd = superCld.getFieldDescriptorByName(name);
  +            }
  +        }
  +
  +        return fd;
  +    }
  +
  +    private Map getFieldDescriptorByNameMap()
  +    {
           if (m_fieldDescriptorNameMap == null)
           {
               HashMap nameMap = new HashMap();
   
               FieldDescriptor[] descriptors = getFieldDescriptions();
  -            for (int i = descriptors.length - 1; i >= 0; i--)
  +            if (descriptors != null)
               {
  -                FieldDescriptor fld = descriptors[i];
  -                nameMap.put(fld.getPersistentField().getName(), fld);
  +                for (int i = descriptors.length - 1; i >= 0; i--)
  +                {
  +                    FieldDescriptor fld = descriptors[i];
  +                    nameMap.put(fld.getPersistentField().getName(), fld);
  +                }
               }
  -
               m_fieldDescriptorNameMap = nameMap;
           }
   
  -        return (FieldDescriptor) m_fieldDescriptorNameMap.get(name);
  +        return m_fieldDescriptorNameMap;
       }
   
       /**
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-dev-help@db.apache.org


Mime
View raw message