Mapping of the line number

29 views
Skip to first unread message

Richard Moore

unread,
May 17, 2022, 11:16:23 AM5/17/22
to beanio-users
I need to have the reader line number mapped to each record. Is there a way to add a field to my class and have beanio map the line number to it?

final BeanReader reader = factory.createReader(INPUT_STREAM_NAME, in);
        Object record = null;

        try {
            while ((record = reader.read()) != null) {
                System.out.println("\n" + record);
                ISA isa = (ISA) record; // consists of several records from the file.


<group name="isa" order="1" minOccurs="1" maxOccurs="1" class="edi.x12.v004010.segment.ISA">
            <record name="isa" order="1" minOccurs="1" maxOccurs="1">
                <field name="segmentId" rid="true" literal="ISA" />
                <field name="authorizationQualifier" />
...
                <field name="componentElementSeparator" />
                <field name="beanioReaderLineNumber" />
            </record>
               
            <group name="gs" order="2" minOccurs="1" maxOccurs="unbounded" collection="list" class="edi.x12.v004010.segment.GS">
                <record name="gs" order="1" minOccurs="1" maxOccurs="1">
                    <field name="segmentId" rid="true" literal="GS" />
                    <field name="functionalGroup" />
...
                    <field name="beanioReaderLineNumber" />
...
Reply all
Reply to author
Forward
0 new messages