You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xmlbeans.apache.org by David Smiley <ds...@mitre.org> on 2004/08/10 16:40:48 UTC

generated source; get-primitives should call get-xmlobjs

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/