HEADER
n RECORDS
TRAILER
GroupBuilder groupBuilder = new GroupBuilder("file")
.type(PaymentSlipFile.class)
.addRecord(PaymentSlipHeader.class)
.addRecord(PaymentSlipRecord.class)
.addRecord(PaymentSlipTrailer.class);
StreamBuilder streamBuilder = new StreamBuilder("paymentslip")
.format("fixedlength")
.parser(new FixedLengthParserBuilder().recordTerminator("\r\n"))
.addGroup(groupBuilder);
factory.define(streamBuilder);
BeanReader in = factory.createReader("paymentslip", new FileReader(file));
PaymentSlipFile psFile = (PaymentSlipFile) in.read();
in.close();
@Group(order = 1, name = "file")
public class PaymentSlipFile {
private PaymentSlipHeader header;
private List<PaymentSlipRecord> records = new ArrayList<PaymentSlipRecord>();
private PaymentSlipTrailer trailer;
}
@Record(name="header", order = 1, minOccurs = 1, maxOccurs = 1)
public class PaymentSlipHeader {
@Field(at = 0, length = 1, rid = true, literal = "0")
private Integer headerCode;
}
@Record(name = "records", order = 2, minOccurs = 1, maxOccurs = -1, collection = PaymentSlipRecord.class)
public class PaymentSlipRecord {
@Field(at = 0, length = 1, rid = true, literal = "1")
private Integer recordType;
}
@Record(name = "trailer", order = 3, minOccurs = 1, maxOccurs = 1)
public class PaymentSlipTrailer {
@Field(at = 0, length = 1, rid = true, literal = "9")
private Integer recordType;
}
org.beanio.BeanIOConfigurationException: Invalid record 'records', in group 'file', in stream 'paymentslip': Collection required when maxOccurs is greater than 1 and class is set
Caused by: org.beanio.BeanIOConfigurationException: Collection required when maxOccurs is greater than 1 and class is set
Caused by: org.beanio.BeanIOConfigurationException: At least one record or group is required.
@Group(order = 1, name = "file", xmlType = XmlType.NONE)
public class PaymentSlipFile {
@Record(name="header", order = 1, minOccurs = 1, maxOccurs = 1)
private PaymentSlipHeader header;
@Record(name = "records", order = 2, minOccurs = 1, maxOccurs = -1, collection = List.class)
@Fields({
@Field(name = "recordType", at = 0, length = 1, rid = true, literal="1")
})
private List<PaymentSlipRecord> records = new ArrayList<PaymentSlipRecord>();
@Record(name = "trailer", order = 3, minOccurs = 1, maxOccurs = 1)
private PaymentSlipTrailer trailer;
}
@Record(name = "records", order = 2, minOccurs = 1, maxOccurs = -1, collection = List.class)
@Fields({
@Field(name = "id", at=0, length = 1, rid = true, literal="1")
})
@Field(at = 0, length = 1, rid = true, literal = "1")
private Integer id;
--
You received this message because you are subscribed to a topic in the Google Groups "beanio-users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/beanio/hG2ELd38_EQ/unsubscribe.
To unsubscribe from this group and all its topics, send an email to beanio+un...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
ritz, did you ever resolve your issue?
--
You received this message because you are subscribed to a topic in the Google Groups "beanio-users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/beanio/hG2ELd38_EQ/unsubscribe.
To unsubscribe from this group and all its topics, send an email to beanio+unsubscribe@googlegroups.com.
To unsubscribe from this group and all its topics, send an email to beanio+un...@googlegroups.com.