pivot-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Noel Grandin <noelgran...@gmail.com>
Subject reducing code for BXML serialisation
Date Sat, 04 Sep 2010 11:09:22 GMT

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