print x div 0
print x div 0

Reputation: 1494

Getting data out of an Object ; JAVA

I would like to get the information of an Object.

I call a Webservice form a client, and get the response.

Object result = envelope.getResponse();

The Webservice returns an ArrayList<String>

How do I access the data ?

The Webservice fills the ArrayList like this, the information are parsed from a XML file.

tempDataStorage.add(getValue("ITEM_NAME", element));
tempDataStorage.add(getValue("VALUE", element));
tempDataStorage.add(getValue("CURRENCY", element));
tempDataStorage.add(getValue("DESCRIPTION", element));

return tempDataStorage;

To be more specific:

How can I get the ITEM_NAME, VALUE, CURRENCY, DESCRIPTION into a String variables, on the Client side?

Please tell me, if you need me to provide more information.

Thank you!

Upvotes: 0

Views: 103

Answers (3)

Shuhail Kadavath
Shuhail Kadavath

Reputation: 448

Casting to ArrayList can give you the solution

((ArrayList)object).get(i) // i is the index 

Upvotes: 2

Suresh Atta
Suresh Atta

Reputation: 121998

Cast your result to ArrayList<String> and use ArrayList#get(int) method.

like

ArrayList<String> resultList = (ArrayList<String>) result;

Then you know the story right ?? :)

Remember index starts from 0

Upvotes: 3

user2652246
user2652246

Reputation:

Cast to an ArrayList.

((ArrayList)object).get(itemindex);

That should work.

Upvotes: 2

Related Questions