AccountCache: Rename maybeGet to get

maybeGet is the method that most callers should use. Make this more
obvious by renaming it to get. Also the return type of Optional already
implies that there might not be a result, hence the method name doesn't
need to be explicit about this.

Change-Id: I571fa9989b2629d96f2238d4b8571d669a9bc89d
Signed-off-by: Edwin Kempin <ekempin@google.com>
This commit is contained in:
Edwin Kempin
2018-01-30 16:17:26 +01:00
parent 60951298e3
commit 5c676582ad
33 changed files with 47 additions and 47 deletions

View File

@@ -56,7 +56,7 @@ public class GetDiffPreferences implements RestReadView<AccountResource> {
Account.Id id = rsrc.getUser().getAccountId();
return accountCache
.maybeGet(id)
.get(id)
.map(AccountState::getDiffPreferences)
.orElseThrow(() -> new ResourceNotFoundException(IdString.fromDecoded(id.toString())));
}

View File

@@ -56,7 +56,7 @@ public class GetEditPreferences implements RestReadView<AccountResource> {
Account.Id id = rsrc.getUser().getAccountId();
return accountCache
.maybeGet(id)
.get(id)
.map(AccountState::getEditPreferences)
.orElseThrow(() -> new ResourceNotFoundException(IdString.fromDecoded(id.toString())));
}

View File

@@ -54,7 +54,7 @@ public class GetPreferences implements RestReadView<AccountResource> {
Account.Id id = rsrc.getUser().getAccountId();
return accountCache
.maybeGet(id)
.get(id)
.map(AccountState::getGeneralPreferences)
.orElseThrow(() -> new ResourceNotFoundException(IdString.fromDecoded(id.toString())));
}