pivot-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Greg Brown <gkbr...@mac.com>
Subject Re: reducing code for BXML serialisation
Date Sat, 04 Sep 2010 11:49:11 GMT
It is an interesting idea, but BXMLSerializer isn't the only client of these methods. Also,
I tried to add enum support to BXMLSerializer at one point but couldn't get it to work (if
I recall correctly, I wasn't able to use reflection to dynamically create enums of the appropriate

On Sep 4, 2010, at 7:09 AM, Noel Grandin wrote:

> Hi
> I note that we have lots of methods of the form
> public void setFoo(String s)  {
>  .. decode s and call setFoo(FooEnum)
> }
> public void setFoo(FooEnum e) {
> }
> And most of the time, the decoding process is identical for all of the
> methods that take a given argument type.
> I suggest that we teach BXMLSerialiser to look for methods of the form
> public String bxmlFromString(T arg)
> on the destination object, which it will use to decode the argument
> from a string, and then call the real setter.
> That should allow us to remove virtually all of our extra setFoo()
> methods into an appropriate superclass (like Component).
> -- Noel

View raw message