BeanIO 2.0.4

org.beanio.stream
Interface RecordParserFactory

All Known Implementing Classes:
CsvRecordParserFactory, DelimitedRecordParserFactory, FixedLengthRecordParserFactory, JsonRecordParserFactory, RecordParserFactorySupport, XmlRecordParserFactory

public interface RecordParserFactory

Factory interface for creating record parsers.

The Java object bound to a record depends on the stream format. The following table shows the object used for each format:

Format Record Type
Fixed Length String
CSV, Delimited String[]
XML Document

The following table shows the method invoked for a requested BeanIO interface.

Requests For Invokes
BeanReader createReader(Reader)
BeanWriter createWriter(Writer)
Unmarshaller createUnmarshaller()
Marshaller createMarshaller()

A RecordParserFactory implementation must be thread safe (after all of its properties have been set).

Since:
2.0
Author:
Kevin Seim
See Also:
RecordReader, RecordWriter, RecordMarshaller, RecordUnmarshaller

Method Summary
 RecordMarshaller createMarshaller()
          Creates a parser for marshalling records.
 RecordReader createReader(Reader in)
          Creates a parser for reading records from an input stream.
 RecordUnmarshaller createUnmarshaller()
          Creates a parser for unmarshalling records.
 RecordWriter createWriter(Writer out)
          Creates a parser for writing records to an output stream.
 void init()
          Initializes the factory.
 

Method Detail

init

void init()
          throws IllegalArgumentException
Initializes the factory. This method is called when a mapping file is loaded after all parser properties have been set, and is therefore ideally used to preemptively validate parser configuration settings.

Throws:
IllegalArgumentException - if the parser configuration is invalid

createReader

RecordReader createReader(Reader in)
                          throws IllegalArgumentException
Creates a parser for reading records from an input stream.

Parameters:
in - the input stream to read from
Returns:
the created RecordReader
Throws:
IllegalArgumentException - if this factory is improperly configured and a RecordReader cannot be created

createWriter

RecordWriter createWriter(Writer out)
                          throws IllegalArgumentException
Creates a parser for writing records to an output stream.

Parameters:
out - the output stream to write to
Returns:
the new RecordWriter
Throws:
IllegalArgumentException - if this factory is improperly configured and a RecordWriter cannot be created

createMarshaller

RecordMarshaller createMarshaller()
                                  throws IllegalArgumentException
Creates a parser for marshalling records.

Returns:
the created RecordMarshaller
Throws:
IllegalArgumentException - if this factory is improperly configured and a RecordMarshaller cannot be created

createUnmarshaller

RecordUnmarshaller createUnmarshaller()
                                      throws IllegalArgumentException
Creates a parser for unmarshalling records.

Returns:
the created RecordUnmarshaller
Throws:
IllegalArgumentException - if this factory is improperly configured and a RecordUnmarshaller cannot be created

BeanIO 2.0.4

Copyright © 2010-2013 Kevin Seim