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:
@@ -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())));
|
||||
}
|
||||
|
||||
@@ -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())));
|
||||
}
|
||||
|
||||
@@ -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())));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user