darshan kamat
darshan kamat

Reputation: 424

Setter method not generated for JAX B object of type list

Setter method is not generated when i create JAX classes from XSD,for maxOccurs=unbounded type. I need to manually add setter method for DetailType .Is this the right approach since i need to populate DetailType inside the root element

@XmlRootElement(name = "WPExchangeRate")
public class WPExchangeRate {

    @XmlElement(name = "Header")
    protected HeaderType header;
    @XmlElement(name = "Detail", required = true)
    protected List<DetailType> detail;
    @XmlElement(name = "Trailer")
    protected TrailerType trailer;

Upvotes: 0

Views: 530

Answers (2)

Niv Bromberg
Niv Bromberg

Reputation: 16

If you are using Maven:
In your pom.xml add to the plugin's <configuration>:

<args>
    <arg>-Xsetters</arg>
</args>

If you want to configure generation method: -Xsetters-mode=accessor or -Xsetters-mode=direct.


If you are generating from command line:
Add -Xsetters to the command (same for -Xsetters-mode).

Upvotes: 0

lexicore
lexicore

Reputation: 43691

This is by design. Just do getDetail().add(myDetail).

Upvotes: 2

Related Questions