DataSourceMapper

DataSourceMapper<In,Out> encapuslates a DataSource instance of type In and exposes a new interface of DataSource of type Out, mapping the objects using a Mapper<In,Out> and Mapper<Out,In>.

Usage

val dataSource = InMemoryDataSource<String, A>()
val dataSourceMapper = DataSourceMapper(dataSource,
dataSource,
dataSource,
AtoBMapper(),
BtoAMapper())
dataSourceMapper.put("myKey", B())
dataSourceMapper.get("myKey")

Query Types

Any Query can be passed to a DataSourceMapper<In,Out>.

Other Implementations

Together with DataSourceMapper<In,Out> there are also similar implementations for:

  • GetDataSourceMapper<In,Out>: Implements GetDataSource.
  • PutDataSourceMapper<In,Out>: Implements PutDataSource.

There is no need to map a DeleteDataSource.