commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From guillaume.tul...@fr.thalesgroup.com
Subject RE: [beanutils] Indexed/Mapped DynaProperty
Date Fri, 13 Feb 2004 09:27:08 GMT
I'd like to add some remarks/questions:

- in fact, the javadoc for the method DynaBean#get(String name) says
"Return the value of a simple property with the specified name" and
I though it was not allowed to call it on an indexed/mapped property
without throwing an IllegalArgumentException

- indexed properties always reference array or List types but what for 
Collection in a more general way ? Is there a restriction with this
interface (except the fact that a collection does not always contain 
indexed element) ? Your solution would suit me perfectly if it could
be extended to the Collection type.

- I think another useful addition to the API would be iterator(property).
This addition depends on the fact that we are able to work directly
with collection or not...

- why the signature of the method DynaBean#get(String name, String key)
is not rather get(String name, Object key) ?

Anyway, thanks for your replies,
Guillaume.

-----Message d'origine-----
De : Niall Pemberton [mailto:niall.pemberton@blueyonder.co.uk]
Envoyé : vendredi 13 février 2004 02:21
À : Jakarta Commons Developers List
Objet : Re: [beanutils] Indexed/Mapped DynaProperty


Shouldn't it be though - if you look at DynaProperty it has an isIndexed()
method which checks if the type is either an array or a List and it has an
isMapped() method which checks if the type is a Map. Doesn't that imply that
these define the types for mapped and indexed properties? Obviously an
implementation could ignore that and set/get values to other types
(WrapDynaBean being an example that could break that rule). Interesting
enough BasicDynaBean doesn't bother using these methods, but duplicates the
code and I guess if the standard implementation ignores them, it doesn't
give them much weight.

Also, maybe my solution would suit Guillaume - because perhaps he knows all
his mapped/indexed properties are backed by Maps, Lists and arrays and he
can live with that - mine are and I don't think thats much of a restriction
as they are only types and not implementations.

Don't get me wrong, I'm not arguing against an API change - I think
size(property) and keySet(property) methods would be v. useful additions to
the API - less getting and casting - making code neater and simpler.

Niall


----- Original Message ----- 
From: "robert burrell donkin" <robertburrelldonkin@blueyonder.co.uk>
To: "Jakarta Commons Developers List" <commons-dev@jakarta.apache.org>
Sent: Thursday, February 12, 2004 10:43 PM
Subject: Re: [beanutils] Indexed/Mapped DynaProperty


> i think that the issue is that though the property acts like a map,
> there is actually no guarantee that it will actually be backed by a
> map. a DynaBean is quite at liberty to use something different - for
> example, instances of an enumeration class.
>
> that's why i think an addition to the API would be needed which would
> allow the underlying implementation to be supply the information
> required.
>
> - robert
>
> On 10 Feb 2004, at 23:22, Niall Pemberton wrote:
>
> > I don't understand what the issue is, if you want the keyset fro
> > example
> > then...
> >
> >     Map myMap = (Map)myDynaBean.get("myMapPropertyName");
> >     Set myKeySet = myMap.keySet()
> >
> > Niall
> >
> >
> > ----- Original Message -----
> > From: "robert burrell donkin" <robertburrelldonkin@blueyonder.co.uk>
> > To: "Jakarta Commons Developers List" <commons-dev@jakarta.apache.org>
> > Cc: "Jakarta Commons Users List" <commons-user@jakarta.apache.org>
> > Sent: Tuesday, February 10, 2004 10:26 PM
> > Subject: Re: [beanutils] Indexed/Mapped DynaProperty
> >
> >
> >> hmmm....
> >>
> >> bit of a tough one this. i think that it'd involve an addition to the
> >> DynaBean's API. this is question probably belongs on the dev list so
> >> i'd suggest that we take it there. (if you're unwilling to process -
> >> by
> >> filtering - the torrent of mail that is commons-dev then you might
> >> like
> >> to subscribe through the news bridge at gname, i think.)
> >>
> >> - robert
> >>
> >> On 6 Feb 2004, at 09:07, guillaume.tuloup@fr.thalesgroup.com wrote:
> >>
> >>>
> >>>  Hi,
> >>>
> >>>   is it possible to have the length/keyset of an indexed/mapped
> >>> dynaproperty
> >>> ? My wish is to copy a dynaproperty from a dynabean to another, any
> >>> other
> >>> solution will be appreciated...
> >>>
> >>> TIA,
> >>> Guillaume.
> >>>
> >>> ---------------------------------------------------------------------
> >>> To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
> >>> For additional commands, e-mail: commons-user-help@jakarta.apache.org
> >>>
> >>
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
> >> For additional commands, e-mail: commons-dev-help@jakarta.apache.org
> >>
> >>
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: commons-dev-help@jakarta.apache.org
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-dev-help@jakarta.apache.org
>
>



---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Mime
View raw message