I recently upgraded BeanIO in my project from 1.2.3 to 2.0.6 and as part of that upgrade I had to modify some of my mappings that where using the Bean element to start using Segment element.
But what I noticed is that previously if a line in a stream had to little fields beanio would still initialize the object defined in the bean element in the mapping. Where as now in the same scenario the property that should be set with the object is simply set to null.
Old code that worked and populated the testName property with a empty Test object:
<bean name="testName" class="com.project.Test">
<field name="test1" type="string" default=""/>
<field name="test2" type="string" default=""/>
</bean>
New code that doesn't initialize the Test object and sets the testName property to null:
<segment name="testName" class="com.project.Test" minOccurs="0">
<field name="test1" type="string" default="" minOccurs="0"/>
<field name="test2" type="string" default="" minOccurs="0"/>
</segment>
Is there a way to force the Segment element to always initialize an object? (Yes I do need to keep minOccurs="0" and no if I remove it, it doesn't solve the issue)
Thx,
goe