  | Mailing List | | Home | | Forum Home | | JBoss - Java Application Server | | Tomcat - JSP/Servlet container | | Struts - A MVC web framework | | iText - An open source PDF Java Library | | JDOM - JDOM XML Parser | | JSP - A mailing list about Java Server Pages specification and reference | | J2EE - A mailing list for Java(tm) 2 Platform, Enterprise Edition | | J2EE Pattern - An interest list for Sun Java Center J2EE Pattern Catalog | | Servlet - A mailing list for discussion about Sun Microsystem's Java Servlet API Technology | |
Struts & Hibernate
|
|
|
  | | | Subject: Document getter/setter not the same (collection vs List) | Subject: Document getter/setter not the same (collection vs List) 2007-09-19 - By IL Bretone
Back
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:
" @(protected) public Document getUserTrainingPlan(@(protected)(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/youraddr@(protected)
|
|
 |