mirror of
https://github.com/google/nomulus.git
synced 2025-05-21 19:59:34 +02:00
Make loadByForeignKeyCached() return an Optional type
Next up (and a much larger commit) will be giving loadByForeignKey() the same treatment. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=225182377
This commit is contained in:
parent
400994237c
commit
015c854a92
4 changed files with 18 additions and 21 deletions
|
@ -30,9 +30,7 @@ public class NameserverLookupByHostCommand extends DomainOrHostLookupCommand {
|
|||
|
||||
@Override
|
||||
protected Optional<WhoisResponse> getResponse(InternetDomainName hostName, DateTime now) {
|
||||
final HostResource hostResource =
|
||||
loadByForeignKeyCached(HostResource.class, hostName.toString(), now);
|
||||
return Optional.ofNullable(
|
||||
hostResource == null ? null : new NameserverWhoisResponse(hostResource, now));
|
||||
return loadByForeignKeyCached(HostResource.class, hostName.toString(), now)
|
||||
.map(host -> new NameserverWhoisResponse(host, now));
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue