xml-xmlbeans-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Smiley <dsmi...@mitre.org>
Subject generated source; get-primitives should call get-xmlobjs
Date Tue, 10 Aug 2004 14:40:48 GMT
Hi.  I'm popping onto the developer discussion list to offer a few  
suggestions from my brief use of XML Beans.

I looked through generated source code for the *Impl of the interfaces.  
  I think there's some easy enhancements that can be made.  Notably, I  
observe that the getters for primitives are almost the same as their  
XmlObject counterparts.  It seems to me that, one could simplify the  
getters for primitives so that they call the XmlObject counterpart  
method and then extract the primitive from it for return.  For example:

BEFORE (how things are done now)

     public java.lang.String getStreet()
     {
         synchronized (monitor())
         {
             check_orphaned();
             org.apache.xmlbeans.SimpleValue target = null;
             target =  
(org.apache.xmlbeans.SimpleValue)get_store().find_element_user(STREET$2, 
  0);
             if (target == null)
             {
                 return null;
             }
             return target.getStringValue();
         }
     }

AFTER (my suggestion)

     public java.lang.String getStreet()
     {
         return xgetStreet().getStringValue();
     }


~ David Smiley



- ---------------------------------------------------------------------
To unsubscribe, e-mail:   xmlbeans-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xmlbeans-dev-help@xml.apache.org
Apache XMLBeans Project -- URL: http://xml.apache.org/xmlbeans/


Mime
View raw message