Revert attempt to builder-ify accountModel

This commit is contained in:
Paul Schaub 2019-09-10 21:23:54 +02:00
parent 939ce748ef
commit 3e03f8c630
Signed by: vanitasvitae
GPG Key ID: 62BEE9264BF17311
3 changed files with 6 additions and 4 deletions

View File

@ -49,9 +49,8 @@ public class RoomAccountModel extends AbstractAccountModel {
} }
@Override @Override
public RoomAccountModel setId(long id) { public void setId(long id) {
this.id = id; this.id = id;
return this;
} }
@Override @Override

View File

@ -52,7 +52,10 @@ public class IAccountRepository implements AccountRepository<RoomAccountModel> {
@Override @Override
public Single<Long> insertAccount(@NonNull RoomAccountModel accountModel) { public Single<Long> insertAccount(@NonNull RoomAccountModel accountModel) {
return accountDao.insert(accountModel) return accountDao.insert(accountModel)
.map(accountId -> accountModel.setId(accountId).getId()) .map(accountId -> {
accountModel.setId(accountId);
return accountId;
})
.doOnSubscribe(ignore -> Log.v(TAG, "Insert " + accountModel)) .doOnSubscribe(ignore -> Log.v(TAG, "Insert " + accountModel))
.doAfterSuccess(accountId -> Log.v(TAG, "AccountModel has new ID " + accountId)); .doAfterSuccess(accountId -> Log.v(TAG, "AccountModel has new ID " + accountId));
} }

View File

@ -19,7 +19,7 @@ public interface AccountModel {
* *
* @param id account id * @param id account id
*/ */
AccountModel setId(long id); void setId(long id);
/** /**
* Return the password of the XMPP account. * Return the password of the XMPP account.