android10 / android10/Android-CleanArchitecture

Models for list view item and detail view

オープン
#169 コメント 6 件 リアクション 0 件 担当者 0 名 GitHub で見る
discussion question
主要言語
Java
スター
15.5k
フォーク
3.3k
PR マージ指標
30日以内にマージされた PR はありません

説明

I'm fetching some data from 3rd party library to access their API.

For example, i created two use cases(FetchUserList and FetchUserDetail) to fetch user list and user detail.
The user list will be displayed in recycler view but only the user name part. And in user detail view, user name and company name will be displayed.

The model received from the server(API model, as in the library) as follow:

```
class User {
String name;
Int companyId;
...
}

class Company {
Int id;
String companyName;
...
}
```

What model should i create in my domain layer?

Should i create two models, one for the fetch user list use case and another one for fetch detail use case?

Seems the result model will be dictated by the view, in recycler view i don't need company name(exclude unnecessary data), but in the detail view i need to display more data.

I'm thinking something like below, but in the user list view case i do not need the `Company` data

```
class UserModel {
String name;
Company company;
}
```

What would you suggest?

Thank you.

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

評価

この issue はまだ評価されていません。

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。