commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alfonso da Silva <alfonsodasi...@e-milio.com>
Subject Re: [BeanUtils] About DynaProperty definition
Date Fri, 22 Aug 2003 13:05:19 GMT
Hi!

I have two doubts:

1) The present implementation of DynaProperty allows Maps with keys of
any class. However, the defición of DynaBean only allows String keys.

I believe that he is better to modify DynaProperty to adapt it, although
also exists the possibility of extending the DynaBean interface with:

 -java.lang.Object get(java.lang.String name, java.lang.Object key)

 -void set(java.lang.String name, java.lang.Object key, java.lang.Object value)

But it can cause many problems of compatibility!!!!

If everything is ok, I will modify DynaProperty (and I will generate diff ;) ).

2) It would be necessary to modify BasicDynaBean to use the new
functionalities of DynaProperty (if they are implemented, because they
are optional) or is better to create another implementation of Dynabean
that uses them?

Alf.


El Thu, 21 Aug 2003 23:02:37 +0100 robert burrell donkin escribió:

> committed. many thanks.
> 
> if you do decide to submit any further contributions, please do so as 
> diff'
> s (see http://jakarta.apache.org/commons/patches.html and 
> http://jakarta.apache.org/site/getinvolved.html for more details).
> 
> - robert
> 
> On Thursday, August 21, 2003, at 11:49 AM, Alfonso da Silva wrote:
> 
> >
> > I have checked the DynaProperty class and I have made some modifications
> > in 'toString' method and with the serialization methods: I have repeated
> > the same workaround of 'type' attribute with 'keyType' and 'contentType'
> > attributes.
> >
> > I include the 'DynaProperty.java' file in case you consider it useful.
> >
> > Alf.
> >
> >
> >
> > El Mon, 28 Jul 2003 21:17:26 +0100 robert burrell donkin escribió:
> >
> >> i've committed something along the lines i suggested. i'd be
> grateful if
> >> you could download and build the CVS HEAD version then check that the
> >> additions satisfy your needs.
> >>
> >> - robert
> >>
> >> On Monday, July 28, 2003, at 06:34 PM, Alfonso da Silva wrote:
> >>
> >>> Hi!
> >>>
> >>> It sounds great! It's a better solution: clean and painless.
> >>>
> >>> Alf.
> >>>
> >>>
> >>> El Sun, 27 Jul 2003 23:17:16 +0100 robert burrell donkin escribió:
> >>>
> >>>> On Friday, July 25, 2003, at 01:12 PM, Alfonso da Silva wrote:
> >>>>
> >>>>> Hi!
> >>>>>
> >>>>> I have a suggestion about DynaProperty definition. I'm working in
a
> >>>>> persistent layer that works with Dyna* classes.
> >>>>>
> >>>>> With the DynaProperty class, the type of an attribute can be
> >>>> defined. But
> >>>>> if I have an indexed (or a mapped) attribute (Vector, ArrayList,
> >>>>> HashMap...) I cann't define what class of objects can the DynaBean
> >>>>> accepts.
> >>>>>
> >>>>> I need something like this:
> >>>>>
> >>>>>  /* A mapped attribute whith Integer values (and String keys) */
> >>>>>  DynaProperty p = new DynaProperty("integerMap",Integer.class);
> >>>>>  p.setMapped(true);
> >>>>>
> >>>>> or
> >>>>>
> >>>>>  /* An indexed attribute whith String values */
> >>>>>  DynaProperty p = new DynaProperty("stringArray",String.class);
> >>>>>  p.setIndexed(true);
> >>>>>
> >>>>> or
> >>>>>
> >>>>>  /* A mapped attribute that accepts any value */
> >>>>>  DynaProperty p = new DynaProperty("objectMap");
> >>>>>  p.setMapped(true);
> >>>>>
> >>>>> or
> >>>>>
> >>>>>  /* A simple Calendar attibute */
> >>>>>  DynaProperty p = new DynaProperty("calendar",Calendar.class);
> >>>>>
> >>>>> I believe that with indexed attributes (the same with mapped
> >> attributes)
> >>>>> it isn't necessary to specify if it is a ArrayList or a Vector or
an
> >>>>> Array, because we recober the values of the DynaBean with the method
> >>>>> get(java.lang.String name, int index)
> >>>>>
> >>>>> What do you think?
> >>>>
> >>>> hi alf
> >>>>
> >>>> this sounds like a pretty reasonable enhancement. i've taken a
> look at
> >>>> clazz and they use getContentClazz and getKeyClazz so maybe we
> >> could add
> >>>> two additional methods getContentType and getKeyType. these values
> >> would
> >>>> be there just to support introspection of these values rather than
> >> having
> >>>> needing any changes to the current beanutils code, wouldn't they?
> >>>>

--
Mensaje enviado desde http://www.e-milio.com

Mime
View raw message