1
내 viewModel class
리포지토리 패턴을 사용하여 getPosts
리포지토리를 호출하려고합니다.로컬 및 저장소 일반 유형 통합 저장소 유형으로 돌아 가기
두 getPostsArrayfromLocalRoomDB
[개조에서 전화] 및 getPostsArrayfromLocalRoomDB
[객실 DB에서 통화]를 성공적으로 내가 저장소 인터페이스 구현 viewModel
및 저장소에서이 원격 개조 전화와 RepositoryImpl class
에서 호출되는 :
@Override
public Flowable<List<PostFromJsonModel>> getPostsArrayFromRetrofitRemote(String tags) {
//notice <PostFromJsonModel>
return postsFromRemoteDataSource.getAllRemote(tags).toFlowable(BackpressureStrategy.BUFFER);
}
및 룸 DB를 호출이 지역 RoomDB :
,536 나는이 방법 내부 DB와REST API
를 호출하는 내 비즈니스 로직을 삽입 할 수 있도록
@Override
public Flowable<List<PostFromRoomDB>> getPostsArrayfromLocalRoomDB(String tags) {
//notice <PostFromRoomDB>
return postsfromLocalDataSource.getAllLocalDb();
}
지금 나는 불가지론 전화 getPosts
을 원 문제는 내가 반환해야하는지 모르겠입니다 :
what_I_should_return?
public getPosts(String tags){
//I know the business logic here, no need to suggest this
}
나는에
Flowable<List<?>, Flowable<List<T>
등을 시도하지만 난 전화를 통합하기 위해 두 가지 일반적인 유형
PostFromJsonModel
및
PostFromRoomDB
을 결합하는 방법 단서를하지 않았습니다.