RepositoryMapper

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

Usage

fun provideDataRepositoryMapper(dataMapperHarmony: Mapper<@JvmSuppressWildcards DataEntity, @JvmSuppressWildcards DataModel>,
dataEntityMapperHarmony: Mapper<@JvmSuppressWildcards DataModel, @JvmSuppressWildcards DataEntity> ):
RepositoryMapper<DataEntity, DataModel> {
val dataStorageDataSource = DataStorageDataSource()
val singleDataSourceRepository = SingleDataSourceRepository(
dataStorageDataSource,
dataStorageDataSource,
dataStorageDataSource)
return RepositoryMapper(singleDataSourceRepository,
singleDataSourceRepository,
singleDataSourceRepository,
dataMapperHarmony,
dataEntityMapperHarmony)

Operation Types

Any Operation can be passed to a RepositoryMapper<In,Out>.

Other Implementations

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

  • GetRepositoryMapper<In,Out>: Implements GetRepository.
  • PutRepositoryMapper<In,Out>: Implements PutRepository.

There is no need to map a DeleteRepository.