commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Apache Wiki <wikidi...@apache.org>
Subject [Jakarta-commons Wiki] Update of "BeanUtils/FAQ" by AndrewKnowles
Date Wed, 15 Nov 2006 15:57:25 GMT
Dear Wiki user,

You have subscribed to a wiki page or wiki category on "Jakarta-commons Wiki" for change notification.

The following page has been changed by AndrewKnowles:
http://wiki.apache.org/jakarta-commons/BeanUtils/FAQ

------------------------------------------------------------------------------
  
  Now the build system has moved to Maven that won't happen again.
  
+ 
+ === Why do I get ClassCastException when accessing nested maps? ===
+ 
+ Say you have a map which contains a nested map ala:
+ nestedmap.put ("key2", "somevalue");
+ map.put ("key1", nestedmap);
+ 
+ If you use the following syntax:
+ String val = PropertyUtils.getProperty(bean, "map(key1)(key2)");
+ 
+ It will actually return "map(key1)", which will be a Map, not a String.
+ 
+ BeanUtils uses '.' as a property separator, and the second property should actually used
mapped syntax, since it is directly accessing a map now, thus the correct usage should be:
+ String val = PropertyUtils.getProperty(bean, "map(key1).key2");
+ 

---------------------------------------------------------------------
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