AutoBean returning List

Wed, 08 Jan 2014 00:05:01 -0800

have an autobean that returns List<Object>. The reason is the json key to 
which the getListVal() is mapped is an array of string and Integer values.
After filling the autobean, I am able to get the size of getListVal 
properly but while iterating through the returned list, illegalArgument 
Exception is thrown.
If I change the return type as String and have only string values in json 
key it works fine. Is there anything wrong have Object as return type in 
Autobeans?
 
TestAutoBean.java :
 
public List<Object> getListVal();

code while iterating the getListVal returned list and accessing the 
elements  - 

List<Object> values= getListVal();*System.out*.println("params size = 
"+values.size()); 
// this displays correct value

String *s* ="";

*for* (*int* i = 0; i< values.size(); i++)

{

s = (String)values.get(i); // This line throws 
java.lang.IllegalArgumentException: java.lang.Object .

}

For the above case the json key has only String value.

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to