You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by bu...@apache.org on 2005/05/20 14:20:40 UTC
DO NOT REPLY [Bug 32380] -
[beanutils] Indexed property inside a mapped property cannot be accessed
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=32380>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.
http://issues.apache.org/bugzilla/show_bug.cgi?id=32380
------- Additional Comments From tettoni@iso.org 2005-05-20 14:20 -------
(In reply to comment #0)
Hi, I think the expression parser may be in cause. I feel a fix should go there.
Indeed, for JavaBean's simple properties (as well as for java.util.Map), the
period '.' denotes the operator to dereference from one parent object's
property to it's child object value.
Likewise, for indexed properties (as well as for java.util.List), the "[i]"
syntax represent the derefenrencing of that element (the identifier is a
number, not a name).
Therefore, getProperty(MYLIST, "5") should work, in analogy with getProperty
(MYMAP, "key"). It does not. In any case, the processing of "." or "[]" is left
to the parser.
Solving this would allow Maps of Lists, Lists of Lists, etc. I do not yet see a
limitation, but I don't have enough knowledge of BeanUtils :-)
> Hi, guys.
> Suppose I have a Map, let's call it "building", inside that map I have an
entry
> with key "rooms", which is a Collection. If I try to access room number 20
like
> this:
> "building.rooms[20].type" it doesn't work (throws IllegalArgumentException).
> I made a custom implementation of "building" Map so that I can see what param
is
> passed to the get() method. Surprisingly I see, that
> PropertyUtilsBean.getInstance().getProperty(bean, name) calls get() method on
my
> Map with parameter "rooms[20]" (including index part).
> This is definitely a bug, because getProperty() should recognize, that "rooms"
> is an indexed property (because it has []), so it should cut off "[20]", call
> get("rooms") and then obtain element with index 20 from the retrieved
Collection.
> Please have a look.
--
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org