> public class Component {
> public Icon bxmlFromString(String s) {
> .. decode string URL into Icon here...
> }
> }
>
> public class Button extends Component {
> public void setIcon(Icon icon) {
> }
> }
OK. I see a couple of issues with this:
1) There's no setIcon(String) method that I can call from Java or another
language. I have to use BXML to invoke that setter. That goes against a major
Pivot design principle, which is not to make BXML a dependency.
2) The "bxmlFromString(String)" method can only have a single return type. So,
we can't apply this as a general conversion solution (for example, if we were
to add another version that returned an Orientation, it won't compile).
It also seems too "magicky". The current approach may require some apparent
duplication of code, but it is straightforward and does not rely on
behind-the-scenes tricks.
The intent is good, though. As I mentioned earlier, if you can figure out a way
to generically manipulate enums in BXMLSerializer, we could at least eliminate
those setter overloads.
G