I use (as far as I can imagine it) Mvp and a clean archive. The next is in the data layer, there is a repository in the data layer that receives http_clenta ( retrofit ) and goes to the network to receive data in JSON

I in the repository do the first parsing of data from jsona in pojo and then convert this pojo under the model I need for the domain code, the code looks like this

  @Override public Observable<AuthorizationModel> sendMail(String mail) { return httpClient.getHttpClient().create(AuthorizationServiceApi.class) .sendMail(UniqueUtils.getMacAddr(), mail) .flatMap(authrozationParser::parseAuthorizationDate) .flatMap(serverResponseMapper::transofrmToAuthorizationModel) .subscribeOn(Schedulers.io()) .observeOn(AndroidSchedulers.mainThread()); } 

where do I need to do the parsing? I do in the repository. But I feel oh wrong

    1 answer 1

    DataLayer The architecture of its mb is different. I can advise you not to worry about such issues until it becomes inconvenient to use Repositories. Your example is normal, and if you care about how to separate the parser, I can advise you to separate the data, because you can parse the local data (raw, files), remote data, system data, and so on. Those in your case of authrozationParser could have remoteData then the Repository could have access to the Remote and it would look like this:

     .flatMap(remoteData::parseAuthorizationDate) 

    your repository will then become easier and it will be easier for it to fulfill the intended role of DataMapper, and a copy-paste will leave the repositories

    • one
      thank you!) our answer to the questions I am interested in - elik