Skip to content
Jack Malpo edited this page Jan 31, 2017 · 2 revisions

##Mapper Mappers are single responsibility units which convert a specific "Business Model" to a specific ViewModel. They are employed by the Presenter of the same Privvy Component. Mappers should be used in the Rx stream between a Presenter and an Interactor.

Here's an example of what a Mapper implementation might look like:

final class NumberMapper extends Mapper<Number, NumberViewModel> {

    @Override
    public final NumberViewModel map(Number number) {
        return NumberViewModel.create(number.value);
    }
}
Clone this wiki locally