Package net.obvj.confectory.mapper
Interface Mapper<T>
-
- Type Parameters:
T- the configuration output type
- All Known Implementing Classes:
AbstractBeanMapper,AbstractINIMapper,DocumentMapper,DummyMapper,INIToJSONObjectMapper,INIToObjectMapper,JSONObjectMapper,PropertiesMapper,PropertiesToObjectMapper,StringMapper
public interface Mapper<T>The base interface for a configuration mapper.A
Mapperis an object that carries the business logic for parsing the input stream open by aSourceand producing the final object, which can be typically an "object container" (such as a HashMap or JSON object, for example), or even POJOs (user-defined beans), depending on the selected implementation.- Since:
- 0.1.0
- Author:
- oswaldo.bapvic.jr (Oswaldo Junior)
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description Tapply(InputStream input)Applies thisMapperinto the given input.ConfigurationHelper<T>configurationHelper(T bean)Creates a newConfigurationHelperinstance recommended by thisMapper.
-
-
-
Method Detail
-
apply
T apply(InputStream input) throws IOException
Applies thisMapperinto the given input.Note: The input stream must be closed by the caller after the mapping operation.
- Parameters:
input- the input stream to be mapped- Returns:
- the mapped object
- Throws:
IOException- if a low-level I/O problem (such and unexpected end-of-input, or network error) occurs
-
configurationHelper
ConfigurationHelper<T> configurationHelper(T bean)
Creates a newConfigurationHelperinstance recommended by thisMapper.- Parameters:
bean- the configuration object to be used by the helper- Returns:
- a new
ConfigurationHelperinstance
-
-