Hi Classpath hackers,
I am currently implementing java.beans.XMLDecoder which now starts to work. But I have a small (efficiency) problem.


As you might know the decoder accepts XML data like this:

<object class="java.awt.Point">
   <int>12</int>
   <int>43</int>
</object>

and executes this using reflection as if I had written: new Point(12, 43).
Now something more complicated:

<object class="java.util.HashMap">
   <void method="put">
      <string>someId</string>
      <object class="javax.swing.JFrame"/>
   </void>
</object>

This is equivalent to:

m = new HashMap();
m.put("someId", new JFrame());

(variable m is not needed in XML version)

Now when evaluating the XML data I have to search the method "put" which accepts the two arguments. Having
only String and JFrame as argument types means that the call to


HashMap.class.getMethod("put", new Class[] { String.class, JFrame.class });

will fail. My current naive approach to find HashMap.put(Object, Object) is to generate a long list of a superclasses and
interfaces of all arguments and then calling getMethod("put", ..) with every combination. It should be clear that
performance is not on my side when doing this.


My question is: Is there anything I can do to make this more efficient?

cu
Robert


_______________________________________________ Classpath mailing list [EMAIL PROTECTED] http://lists.gnu.org/mailman/listinfo/classpath

Reply via email to