I have this three types in a XSD:
<xs:element name="Account" type="Account"/>
<xs:element name="Operation" type="Operation"/>
<xs:element name="Transaction" type="Transaction"/>
<xs:complexType name="Operation">
<xs:sequence>
<xs:element name="id" type="xs:long"/>
<xs:element name="type" type="EnumOperationType"/>
<xs:element name="balance" type="xs:double"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="Transaction">
<xs:sequence>
<xs:element name="id" type="xs:long"/>
<xs:element name="type" type="EnumOperationType"/>
<xs:element name="amount" type="xs:double"/>
<xs:element name="isCredit" type="xs:boolean"/>
<xs:element name="isDebit" type="xs:boolean"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="Account">
<xs:sequence>
<xs:element name="agencyNumber" type="xs:long"/>
<xs:element name="accountNumber" type="xs:long"/>
<xs:element name="owner" type="client:Client"/>
<xs:element name="balance" type="xs:double"/>
<xs:element maxOccurs="unbounded" ref="Operation"/>
<xs:element maxOccurs="unbounded" ref="Transaction"/>
</xs:sequence>
</xs:complexType>
When I generate the respectively java objects for them using JABX, I only get set() methods for the first four fields: agecy, account, owner and balance.
How to set the lists in a complex object? Do I have to use the ObjectFactory in any way?
Best, Pedro.
You can do add on addAll on what is returned from the get method to set the content on the List property.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With