You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by Yansheng Lin <ya...@isogis.com> on 2003/10/22 01:17:27 UTC
[BeanUtils] Any similar method in BeanUtils package that does this? (Repost)
Hi, I have used this function more than once. Just wondering if there is a
similar function in BeanUtils package. I found a few close ones, but take
different parameters. Basically I want to extract a Array String(i.e.,
String[]) from a Collection list based on the property passed in.
Any pointers to tutorial on BeanUtils package would be really appreciated! I
have written a lot of functions that I could use PropertyUtils in the first
place. I believe others have done so too. Any help?
----
Thanks!
public String[] extractOpeningIdArray(
ArrayList list,
String property)
throws
IllegalAccessException,
InvocationTargetException,
NoSuchMethodException
{
if (list == null || list.size() == 0)
{
return null;
}
String[] temp = new String[list.size()];
for (int i = 0; i < list.size(); i++)
{
Object bean = list.get(i);
temp[i] = (String) PropertyUtils.getProperty(bean, property);
}
return temp;
}
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org