Package org.beanio.internal.compiler
Class StreamCompiler
- java.lang.Object
-
- org.beanio.internal.compiler.StreamCompiler
-
public class StreamCompiler extends java.lang.ObjectCompiles a mapping file read from anInputStreaminto a collection ofStreamparsers.- Since:
- 2.0
-
-
Constructor Summary
Constructors Constructor Description StreamCompiler(java.lang.ClassLoader classLoader)Constructs a newMappingFactory.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Streambuild(StreamConfig config)Creates a new Stream from its configuration.protected ParserFactorycreateParserFactory(java.lang.String format)Instantiates the factory implementation to create the stream definition.protected java.util.Collection<Stream>createStreamDefinitions(BeanIOConfig config)Creates stream definitions from a BeanIO stream mapping configuration.ConfigurationLoadergetConfigurationLoader()Returns the mapping configuration loader.protected ConfigurationLoadergetDefaultConfigurationLoader()Returns the default mapping configuration loader implementation.java.util.Collection<Stream>loadMapping(java.io.InputStream in, java.util.Properties properties)Loads a mapping file.voidsetConfigurationLoader(ConfigurationLoader configurationLoader)Sets the mapping configuration loader.
-
-
-
Method Detail
-
build
public Stream build(StreamConfig config) throws BeanIOConfigurationException
Creates a new Stream from its configuration.- Parameters:
config- theStreamConfig- Returns:
- the built
Streamdefinition - Throws:
BeanIOConfigurationException- Since:
- 2.0.5
-
loadMapping
public java.util.Collection<Stream> loadMapping(java.io.InputStream in, java.util.Properties properties) throws java.io.IOException, BeanIOConfigurationException
Loads a mapping file.- Parameters:
in- theInputStreamto load the mapping file fromproperties- theProperties- Returns:
- the
Streamparsers configured in the loaded mapping file - Throws:
java.io.IOException- if an I/O error occurs reading the mapping fileBeanIOConfigurationException- if the mapping file is invalid
-
getDefaultConfigurationLoader
protected ConfigurationLoader getDefaultConfigurationLoader()
Returns the default mapping configuration loader implementation.- Returns:
- the default mapping configuration
-
createStreamDefinitions
protected java.util.Collection<Stream> createStreamDefinitions(BeanIOConfig config) throws BeanIOConfigurationException
Creates stream definitions from a BeanIO stream mapping configuration.- Parameters:
config- the BeanIO stream mapping configuration- Returns:
- the collection of stream definitions
- Throws:
BeanIOConfigurationException- if a configuration setting is invalid
-
createParserFactory
protected ParserFactory createParserFactory(java.lang.String format)
Instantiates the factory implementation to create the stream definition.- Parameters:
format- the stream format- Returns:
- the stream definition factory
-
getConfigurationLoader
public ConfigurationLoader getConfigurationLoader()
Returns the mapping configuration loader.- Returns:
- the mapping configuration loader
-
setConfigurationLoader
public void setConfigurationLoader(ConfigurationLoader configurationLoader)
Sets the mapping configuration loader.- Parameters:
configurationLoader- the mapping configuration loader
-
-