commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andrew Hughes <ahhug...@gmail.com>
Subject Re: commons-beanutils : DynaBean's & List<?>
Date Fri, 13 Feb 2009 10:50:50 GMT
Ok, I can add one (or more) DynaBean's as a child properties to a parent
DynaBean.

LazyDynaBean x = new LazyDynaBean();//transparent root.
LazyDynaBean root = new LazyDynaBean();
x.set("root",0,root);
LazyDynaBean world = new LazyDynaBean();
root.set("world",0,world);
/////////and so on......

and for duplicates...

x.set("root",0,rootX);
x.set("root",1,rootY);
x.set("root",2,rootZ);

My only suggestion for the commons group would be to have a method..
append(String key, Object value) ; that would not overwrite a corresponding
key's value, but append it to the end of the list. That way I would not have
to do the 0,1,2 above. Mind you I can implement this myself easily enuff -
but just a thought.

Cheers.


On Fri, Feb 13, 2009 at 10:21 AM, Andrew Hughes <ahhughes@gmail.com> wrote:

> Howdy,
> DynaBean's look brilliant, but I am overwhealmed with options - can anyone
> help me out please?
>
> I have a hierarchy of POJO "Thing"'s which is easiest explained.
>
> + Thing(key="root")
>     + Thing(key="world")
>         + Thing(key="transport")
>             + Thing(key="car")
>             + Thing(key="train")
>         + Thing(key="feature")
>             + Thing(key="road") //note that key'd duplicates exist!
>             + Thing(key="road") //note that key'd duplicates exist!
>             + Thing(key="tree") //note that key'd duplicates exist!
>             + Thing(key="tree") //note that key'd duplicates exist!
>
>
> Many examples use Map's (but that doesn't allow duplicate key's).
>
> For what it's worth, I would like the following pseudo to work...
>
> get("root.world.feature");
>
>
>
> Help would be great,  :)
>
>
> p.s. the actual key's are out of my control and change dynamically at
> runtime.
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message