struts-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Craig R. McClanahan" <craig...@apache.org>
Subject Re: DynaActionForm.getMap() change
Date Wed, 16 Jul 2003 19:29:35 GMT


On Wed, 16 Jul 2003, Rob Leland wrote:

> Date: Wed, 16 Jul 2003 14:58:45 -0400
> From: Rob Leland <rleland@apache.org>
> Reply-To: Struts Developers List <struts-dev@jakarta.apache.org>
> To: Struts Developers List <struts-dev@jakarta.apache.org>
> Subject: Re: DynaActionForm.getMap() change
>
> David Graham wrote:
>
> >DynaActionForm.getMap() returns the Map that the properties are stored in
> >without copying it to a new Map instance or wrapping it in an unmodifiable
> >Map.  IMO, we should treat that method with much more care and return an
> >unmodifiable view of the Map considering it's mainly to be used in JSTL
> >tags.
> >
> Does this solve a problem that you or others have encountered in practice ?
>

I can see where a use who retrieves the Map and then modifies it could
accidentally (or on purpose) violate the type safety checks that the
normal get() and set() calls provide for you.

> -Rob
>
> >
> >Is anyone opposed to this idea?

My only concern would be the performance impact of this, especially if it
happens more than once in the same page (say, because you used the same
dynabean in more than one EL expression).

An alternative approach would be to do what someone else suggested and
make DynaActionForm implement Map directly -- but make it effectively
immutable by throwing UnsupportedOperationException for Map method calls
like put() and remove().  I don't *think* there are any method signature
overlaps that would cause us any grief.

> >
> >David

Craig

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


Mime
View raw message