1

I have a requirement to conditionally validate the format or required=true/false based another fields in a beanmapper configuration. Example:

<stream name="stream1" format="fixedlength" minlength="101" maxlength="101">
  <record name="record1" class="a.b.c.SomeClassName">
    <field name="updateType" required="true" length="1" regex="A|C" />
    <field name="firstName" required=? length="50" format=?/>
    <field name="lastName" required=? length="50" format=?/>
  </record>
</stream>

Condition scenario 1: for updateType="A", I need firstName to have not null ( not all spaces as this is a fixed length format record) and for updateType="C", firstName must be all blanks.

Condition scenario 2: for firstName=some value, lastName must also have some value (non blank)

How can I achieve this in Beanio? I am using spring-batch 3x for my job execution.

pnuts
  • 58,317
  • 11
  • 87
  • 139
Sadique Khan
  • 161
  • 3
  • 13

1 Answers1

0

I could not get any BeanIO utility for this, out of the box. The way I am handling this now is performing those conditional validations in the spring batch processor.

Sadique Khan
  • 161
  • 3
  • 13