google-nomulus/java/google/registry/model/domain
mcilwain 4491b7b909 Make loadByForeignKey() and related methods return Optional
This is safer and addresses a common source of confusion in the codebase because it's always explicit that the resource returned may not be present, whether because it's soft-deleted when projected to the given time or because it never existed in the first place.

In production code, the presence of the returned value is always checked. In test code, its presence is assumed using .get() where that is expected and convenient, as it not being present will throw an NPE that will cause the test to fail anyway.

Note that the roughly equivalent reloadResourceByForeignKey(), which is widely used in test code, is not having this same treatment applied to it. That is out of the scope of this CL, and has much smaller returns anyway because it's only used in tests (where the unexpected absence of a given resource would just cause the test to fail).

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=225424002
2018-12-14 11:24:49 -05:00
..
allocate Update copyright year on all license headers 2017-02-02 16:27:22 -05:00
fee Make EAP fee description check more flexible 2018-05-05 23:26:33 -04:00
fee06 Switch from Guava Optionals to Java 8 Optionals 2017-10-24 16:53:47 -04:00
fee11 Switch from Guava Optionals to Java 8 Optionals 2017-10-24 16:53:47 -04:00
fee12 Switch from Guava Optionals to Java 8 Optionals 2017-10-24 16:53:47 -04:00
launch Allow the same LaunchPhase to be used for both start-date and end-date sunrise 2018-03-06 19:12:56 -05:00
metadata Format some imports using fix_imports.py 2017-10-24 16:53:47 -04:00
rgp Format some imports using fix_imports.py 2017-10-24 16:53:47 -04:00
secdns Format some imports using fix_imports.py 2017-10-24 16:53:47 -04:00
superuser Add support for a domain delete superuser EPP extension 2017-09-12 15:51:50 -04:00
token Index the allocation token's redemption history entry field 2018-10-03 11:52:31 -04:00
DesignatedContact.java Use locking on async mapreduces 2018-08-10 13:44:25 -04:00
DomainApplication.java Remove temporary @OnLoad used for setting period in DomainApplication 2017-06-21 09:51:28 -04:00
DomainAuthInfo.java Update copyright year on all license headers 2017-02-02 16:27:22 -05:00
DomainBase.java Make loadByForeignKey() and related methods return Optional 2018-12-14 11:24:49 -05:00
DomainCommand.java Improve the error when trying to delete the registrant contact 2018-05-17 21:52:35 -04:00
DomainInfoData.java Update copyright year on all license headers 2017-02-02 16:27:22 -05:00
DomainObjectSpec.java Update copyright year on all license headers 2017-02-02 16:27:22 -05:00
DomainRenewData.java Update copyright year on all license headers 2017-02-02 16:27:22 -05:00
DomainResource.java Update lastEppUpdateTime after certain grace period is passed 2018-12-12 13:22:34 -05:00
ForeignKeyedDesignatedContact.java Fix stale documentation on {ForeignKeyed,}DesignatedContact 2017-03-21 15:28:58 -04:00
GracePeriod.java Add relevant exception message for checkArgumentNotNull usage 2018-06-06 15:13:10 -04:00
package-info.java Update copyright year on all license headers 2017-02-02 16:27:22 -05:00
Period.java Format some imports using fix_imports.py 2017-10-24 16:53:47 -04:00