On Sep 20, 2012, at 7:13 AM, "Muller, Anthony" <[email protected]> wrote:
> Hello Sergey, > > When JAXB is used for data binding, is there a way to stream the output > instead of waiting to build the whole object structure to return? The "normal" way to do this with JAXB is to have the objects themselves return more "dynamic" objects instead of static. If you have the @XmlAccessorType set to XmlAccessType.PROPERTY and the getter/setters are annotated instead of the fields, JAXB will call the getter/setters during marshaling. Those getters and setters can dynamically build themselves up rather than returning actual field members. The List returns can even be smarter. JAXB just uses the iterator from the list to write out the list. Thus, the List can be completely dynamic and for each call of "next" on the iterator, create a new object and return it. > This will be very useful when we have large object tree to build! It's a bit tricky to setup, but it can work fairly well. -- Daniel Kulp [email protected] - http://dankulp.com/blog Talend Community Coder - http://coders.talend.com
