Win a copy of Practical SVG this week in the HTML/CSS/JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

possible bug with wsimport - missing setter method for Air element from XSD

 
Victor Skvorzkoff
Greenhorn
Posts: 13
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi everyone,

I am quite new to JAXB and JAX-WS technology. I am using 'wsimport' tool but even to a noobie like me seems something wrong with 'wsimport' tool.

Firstly, I am using this 'wsimport' command to create artifacts from XSD and place them in a JAR:



The problem is that in generated Itinerary.java class there is no setAir() setter corresponding to Air element, only getter, but no setter. Here is (what I believe) relevant part of Itinerary schema part:



I believe there should be a corresponding setAir() method generated in Itinerary.java artifact. However, Itinerary.java only contains getter method. Here are relevant fragments from Itinerary.java:



However, there is no setter setAir() method. When I inspect other generated class for other element in a schema, I see both getter and setter elements created for the same schema structure as with the Itinerary. By the same analogy I think "Air" element in Itinerary should also have a setter element. Otherwise, how would I be able to set values for that node? This seems like a bug with 'wsimport' tool.

Could somebody kindly suggest on how to resolve this problem?

Thank you.
 
Dave Tolls
Ranch Hand
Posts: 2285
25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Look at the JavaDoc there in that code:

This accessor method returns a reference to the live list,
* not a snapshot. Therefore any modification you make to the
* returned list will be present inside the JAXB object.
* This is why there is not a <CODE>set</CODE> method for the air property.

It's intentional.
 
Victor Skvorzkoff
Greenhorn
Posts: 13
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dave Tolls wrote:Look at the JavaDoc there in that code:

This accessor method returns a reference to the live list,
* not a snapshot. Therefore any modification you make to the
* returned list will be present inside the JAXB object.
* This is why there is not a <CODE>set</CODE> method for the air property.

It's intentional.


So getAir() acts as a setter?
 
Dave Tolls
Ranch Hand
Posts: 2285
25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Pretty much:

will add an Air to the List.
 
Victor Skvorzkoff
Greenhorn
Posts: 13
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dave Tolls wrote:Pretty much:

will add an Air to the List.


Thank you.  I got it.  In my 10+ years programming (in any language) it's first time I see getter method in a role of a setter.  
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!