I am trying to add xmlName attribute to a field in my mapping file. Now I know I can add xmlName attribute to any field by adding it manually, but I want to know if it is possible to add it using Java code.
Here is my mapping.xml file:
beanio>
<stream name="employees" format="xml">
<record name="employee" class="example.Employee">
<field name="firstName" />
<field name="lastName" />
<field name="title" />
<field name="salary" />
<field name="hireDate" type="date" />
</record>
</stream>
</beanio>
In the above file, I want to set xmlName attribute for my field firstName as fName. I have looked through BeanIO documentation, but I did not see any method that would help me add xmlName attribute using Java. Is there any way to accomplish this?
Thank you for all the help.
you can refer to BuilderApiAndAnnotations and add xmlName attribute by FieldBuilder#xmlName(String xmlName)