What do folks think about adding a new method to DynaBean called...

public interface DynaBean {
    public void add(String name, Object value);
}

This would allow you to use indexed properties without actually knowing what
the last index is. e.g. rather than

DynaBean db = ...;
db.set("foo", 0, a);
db.set("foo", 1, b);
db.set("foo", 2, c);

You could just do

db.add("foo", a);
db.add("foo", b);
db.add("foo", c);

It'd certainly make using indexed properties more 'Java 2 Collections like'.

Also its becoming quite common for developers to follow the 'adder' pattern.
Its like a getter, but adds one new item to a 'collection' of some kind.
e.g.

public class MyBean {
    public Foo[] getFoos();
    public void addFoo(Foo foo);
}

It'd be nice if the DynaBean.add(String name, Object value) method could
automagically call the adder method for the given pseudo property for the
WrapDynaBean.

One downside with adding any new methods to DynaBean interface is that it'll
break backwards compatiblity. So we should introduce a DynaBeanSupport
classs that folks should be recommended to derive their custom
implementations from. If we did this then we could add other useful helper
methods like..

    public void populate(Map values);


Thoughts?

James


_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to