commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 15519] - PropertyUtils.getPropertyType() for java.util.Collection
Date Mon, 23 Dec 2002 19:17:23 GMT
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=15519>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=15519

PropertyUtils.getPropertyType() for java.util.Collection

craig.mcclanahan@sun.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|REOPENED                    |RESOLVED
         Resolution|                            |WONTFIX



------- Additional Comments From craig.mcclanahan@sun.com  2002-12-23 19:17 -------
The reason this works for arrays is that the type of each element is *required*
to be the same.  If you have a Collection that has mixed types in it, the return
value from getPropertyType() for any particular element would only reflect the
type of that element -- which would be misleading to users who then assume that
this is the only type of property value supported.

As a workaround, your code can certainly ascertain the type of the element
itself quite easily:

  // Bean that has a Collection property named "coll"
  Object mybean = ...;
  Object value = PropertyUtils.getProperty(mybean, "coll[3]");
  Class clazz = value.getClass();

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


Mime
View raw message