I am trying to write a csv file from scala case class using fixed length file BeanIO library.
sample code
case class employee(id:String,name:String,dob:String)
<record name="emp" class="employee">
<field name="id" position="0" length="5" getter="#1" setter="id"/>
<field name="name" position="5" length="5" getter="#2" setter="name"/>
<field name="dob" position="10" length="5" getter="#3" setter="dob"/>
</record>
But I want to avoid dob from writing in the csv file. If I removed that line from xml, it will throw error
Could anyone suggest any way to do that other than removing it from case class or make field length as "zero".
How about treating the dob field as a constant?
Try this:
The value for dob would then not be dependent on the actual value it is set to or not in your class. This way you control the output. You can also experiment with changing the name of the property to something that is not present in the class.