Hi,
I have a question related to the way beanio converts flat files etc to pojo's. Currently, the way beanio works is that you provide it the layout file and the actual file path and it maps the contents of the file to the required java beans. Is it possible to have beanio take in a layout and a string( or for that matter any object ) i.e. basically a single record, such that beanio only maps that specific string/object according to the specified layout?
For example:
//Initialize layout
StreamFactory factory = StreamFactory.newInstance();
factory.loadResource("mapping/beanio-test.xml");
//Specify single record
String record = "Detail,\"Joe\",Smith,Developer,75000,10012009";
BeanReader reader = factory.createReader("employeeFile", null, null);
//Map record to java bean
emp = (Employee)reader.read(record);
The use case for this could be in real time streaming applications like Storm/Spark streaming where the bean creation could be parallelized across multiple instances without doing all the bean creation in a single process itself. Semantics of order etc will need to be preserved by the part of the application consuming this data.
I have gotten this to work locally and I was wondering what the thoughts of the community were on this.
Best,
AJ