Document getter/setter not the same (collection vs List)

IL Bretone <[email protected]>
Newsgroups gmane.comp.java.jdom.general
Message-ID <[email protected]>
Hello,

I'm trying to compile a class which will become a web service, I'm using
Netbeans 5.5 and when i try to compile the following code:

"
    @WebMethod
    public Document getUserTrainingPlan(@WebParam(name="userId") String
userId) {
        
       UserPlan[] availableUserPlans =
AngelSelectQuery.doGetAvailbleUserPlans(userId);
            
       Document doc = new Document();
       Element plans = new Element("plans");
                       
       for  ( int i = 0; i < availableUserPlans.length; i++) {
          Element plan = new Element("plan").setAttribute("id",
availableUserPlans[i].getPlan().getPlanId());
          plan.addContent(new
Element("creationDate").setText(angel.webapp.utils.Date4Jsp.getDate(availableUserPlans[i].getPlan().getCreationDate())));
          plan.addContent(new
Element("name").setText(availableUserPlans[i].getPlan().getPlanName()));
          plan.addContent(new
Element("creator").setText(availableUserPlans[i].getPlan().getCreator().getGeneralInfo()));
          plan.addContent(new
Element("duration").setText(availableUserPlans[i].getPlan().getDuration()));
                plan.addContent(new
Element("avgSpeed").setText(availableUserPlans[i].getPlan().getAverageSpeed()));
                
          plans.addContent(plan);
            }
  
          doc.addContent(plans);
            
            // Debug
            try {
                XMLOutputter outp = new XMLOutputter();
                outp.output(doc, System.out);
            } catch (Exception e){
                System.out.println("Erreur xml: " + e.toString());
            }
        
        return doc;
        
    }
"

it gives me the following error:

"error: The type of the getter is java.util.List but that of the setter is
java.util.Collection. They have to be the same.
        this problem is related to the following location:
                at org.jdom.Document.getContent (Unknown Source)
                at org.jdom.Document (Unknown Source)
                at
angel.ws.jaxws.GetUserTrainingPlanResponse._return(GetUserTrainingPlanResponse.java:17)
                at
angel.ws.jaxws.GetUserTrainingPlanResponse(GetUserTrainingPlanResponse.java:14)
        this problem is related to the following location:
                at org.jdom.Document.setContent (Unknown Source)
                at org.jdom.Document (Unknown Source)
                at
angel.ws.jaxws.GetUserTrainingPlanResponse._return(GetUserTrainingPlanResponse.java:17)
                at
angel.ws.jaxws.GetUserTrainingPlanResponse(GetUserTrainingPlanResponse.java:14)
error: The type of the getter is java.util.List but that of the setter is
java.util.Collection. They have to be the same.
        this problem is related to the following location:
                at org.jdom.Element.getContent (Unknown Source)
                at org.jdom.Element (Unknown Source)
                at org.jdom.Document.getRootElement (Unknown Source)
                at org.jdom.Document (Unknown Source)
                at
angel.ws.jaxws.GetUserTrainingPlanResponse._return(GetUserTrainingPlanResponse.java:17)
                at
angel.ws.jaxws.GetUserTrainingPlanResponse(GetUserTrainingPlanResponse.java:14)
        this problem is related to the following location:
                at org.jdom.Element.setContent (Unknown Source)
                at org.jdom.Element (Unknown Source)
                at org.jdom.Document.getRootElement (Unknown Source)
                at org.jdom.Document (Unknown Source)
                at
angel.ws.jaxws.GetUserTrainingPlanResponse._return(GetUserTrainingPlanResponse.java:17)
                at
angel.ws.jaxws.GetUserTrainingPlanResponse(GetUserTrainingPlanResponse.java:14)
error: org.jdom.Namespace does not have a no-arg default constructor.
        this problem is related to the following location:
                at org.jdom.Namespace (Unknown Source)
                at org.jdom.Element.getNamespace (Unknown Source)
                at org.jdom.Element (Unknown Source)
                at org.jdom.Document.getRootElement (Unknown Source)
                at org.jdom.Document (Unknown Source)
                at
angel.ws.jaxws.GetUserTrainingPlanResponse._return(GetUserTrainingPlanResponse.java:17)
                at
angel.ws.jaxws.GetUserTrainingPlanResponse(GetUserTrainingPlanResponse.java:14)
3 errors
error: compilation failed, errors should have been reported
"

What should I do ? I wouldn't like to rewrite jdom ;)

Cheers,
Joel
-- 
View this message in context: http://www.nabble.com/Document-getter-setter-not-the-same-%28collection-vs-List%29-tf4480002.html#a12774459
Sent from the JDOM - General mailing list archive at Nabble.com.

_______________________________________________
To control your jdom-interest membership:
http://www.jdom.org/mailman/options/jdom-interest/[email protected]
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.