Package org.beanio.stream
Interface RecordParserFactory
-
- All Known Implementing Classes:
CsvRecordParserFactory,DelimitedRecordParserFactory,FixedLengthRecordParserFactory,JsonRecordParserFactory,RecordParserFactorySupport,XmlRecordParserFactory
public interface RecordParserFactoryFactory 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 StringCSV, Delimited String[]XML DocumentThe following table shows the method invoked for a requested BeanIO interface.
Requests For Invokes BeanReadercreateReader(Reader)BeanWritercreateWriter(Writer)UnmarshallercreateUnmarshaller()MarshallercreateMarshaller()A
RecordParserFactoryimplementation must be thread safe (after all of its properties have been set).- Since:
- 2.0
- See Also:
RecordReader,RecordWriter,RecordMarshaller,RecordUnmarshaller
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description RecordMarshallercreateMarshaller()Creates a parser for marshalling records.RecordReadercreateReader(java.io.Reader in)Creates a parser for reading records from an input stream.RecordUnmarshallercreateUnmarshaller()Creates a parser for unmarshalling records.RecordWritercreateWriter(java.io.Writer out)Creates a parser for writing records to an output stream.voidinit()Initializes the factory.
-
-
-
Method Detail
-
init
void init() throws java.lang.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:
java.lang.IllegalArgumentException- if the parser configuration is invalid
-
createReader
RecordReader createReader(java.io.Reader in) throws java.lang.IllegalArgumentException
Creates a parser for reading records from an input stream.- Parameters:
in- the input stream to read from- Returns:
- the created
RecordReader - Throws:
java.lang.IllegalArgumentException- if this factory is improperly configured and aRecordReadercannot be created
-
createWriter
RecordWriter createWriter(java.io.Writer out) throws java.lang.IllegalArgumentException
Creates a parser for writing records to an output stream.- Parameters:
out- the output stream to write to- Returns:
- the new
RecordWriter - Throws:
java.lang.IllegalArgumentException- if this factory is improperly configured and aRecordWritercannot be created
-
createMarshaller
RecordMarshaller createMarshaller() throws java.lang.IllegalArgumentException
Creates a parser for marshalling records.- Returns:
- the created
RecordMarshaller - Throws:
java.lang.IllegalArgumentException- if this factory is improperly configured and aRecordMarshallercannot be created
-
createUnmarshaller
RecordUnmarshaller createUnmarshaller() throws java.lang.IllegalArgumentException
Creates a parser for unmarshalling records.- Returns:
- the created
RecordUnmarshaller - Throws:
java.lang.IllegalArgumentException- if this factory is improperly configured and aRecordUnmarshallercannot be created
-
-