[jboss-user] [EJB 3.0] - getter/setter for ArrayList embedded in HashMap
peiguo
do-not-reply at jboss.com
Fri May 2 13:42:38 EDT 2008
I original posted this in WS forum, but I found there were many posts there with zero reply, so I just reposted it here.
My question really comes down to whether I can write getter/setter for the ArrayList embedded in the HashMap.
Original Post:
I have getter/setter defined for properties, but still cannot send object of this class through WS, because the JBOSS generated WSDL doesn't include correct information for ArrayList. How can I correct this?
|
| package org.jboss.tutorial.webservice.bean;
|
| import java.util.*;
| import java.io.*;
|
| public class Something {
| private int a;
| private double b;
|
|
| private HashMap<String, ArrayList<String>> c;
|
| public Something() {
| a = 1;
| b = 2.0;
| c = new HashMap<String, ArrayList<String>>();
| {
| ArrayList<String> arr = new ArrayList<String>();
| arr.add("This is fun");
| arr.add("Interesting");
| arr.add("What is this?");
| c.put("thought", arr);
| }
| {
| ArrayList<String> arr = new ArrayList<String>();
| arr.add("Kaveh");
| arr.add("David");
| arr.add("Costa");
| c.put("name", arr);
| }
| {
| ArrayList<String> arr = new ArrayList<String>();
| arr.add("green apple");
| arr.add("orange orange");
| arr.add("yellow mango");
| c.put("fruit", arr);
| }
| {
| ArrayList<String> arr = new ArrayList<String>();
| arr.add("they shoot horse");
| arr.add("sleppless in seattle");
| arr.add("thank you for smoking");
| c.put("movie", arr);
| }
| }
|
| public int getA() {
| return a;
| }
|
| public void setA(int a) {
| this.a = a;
| }
|
| public double getB() {
| return b;
| }
|
| public void setB(double b) {
| this.b = b;
| }
|
| public HashMap<String, ArrayList<String>> getC() {
| return c;
| }
|
| public void setC(HashMap<String, ArrayList<String>> c) {
| this.c = c;
| }
|
| public ArrayList<String> getC(String i) {
| return c.get(i);
| }
|
| public void setC(String i, ArrayList<String> c) {
| this.c.put(i, c);
| }
|
| }
|
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4148414#4148414
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4148414
More information about the jboss-user
mailing list