Remove @EmptySetToNull (#1878)

This annotation was only used in cross-database comparison.

<!-- Reviewable:start -->
- - -
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/google/nomulus/1878)
<!-- Reviewable:end -->
This commit is contained in:
Lai Jiang 2022-12-09 15:07:00 -05:00 committed by GitHub
parent e93a015451
commit d8a835cf43
4 changed files with 3 additions and 14 deletions

View file

@ -51,15 +51,6 @@ public abstract class ImmutableObject implements Cloneable {
@Target(FIELD) @Target(FIELD)
public @interface DoNotHydrate {} public @interface DoNotHydrate {}
/**
* Indicates that the field stores a null value to indicate an empty set. This is also used in
* object comparison.
*/
@Documented
@Retention(RUNTIME)
@Target(FIELD)
public @interface EmptySetToNull {}
/** /**
* Indicates that the field does not take part in the immutability contract. * Indicates that the field does not take part in the immutability contract.
* *

View file

@ -124,7 +124,7 @@ public class DomainBase extends EppResource
String tld; String tld;
/** References to hosts that are the nameservers for the domain. */ /** References to hosts that are the nameservers for the domain. */
@EmptySetToNull @Transient Set<VKey<Host>> nsHosts; @Transient Set<VKey<Host>> nsHosts;
/** Contacts. */ /** Contacts. */
VKey<Contact> adminContact; VKey<Contact> adminContact;

View file

@ -96,7 +96,6 @@ public class DomainHistory extends HistoryEntry {
columnList = columnList =
"domain_history_history_revision_id,domain_history_domain_repo_id,host_repo_id", "domain_history_history_revision_id,domain_history_domain_repo_id,host_repo_id",
unique = true)) unique = true))
@EmptySetToNull
@Column(name = "host_repo_id") @Column(name = "host_repo_id")
Set<VKey<Host>> nsHosts; Set<VKey<Host>> nsHosts;
@ -160,7 +159,6 @@ public class DomainHistory extends HistoryEntry {
@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.EAGER, orphanRemoval = true) @OneToMany(cascade = CascadeType.ALL, fetch = FetchType.EAGER, orphanRemoval = true)
@JoinColumn(name = "historyRevisionId", referencedColumnName = "historyRevisionId") @JoinColumn(name = "historyRevisionId", referencedColumnName = "historyRevisionId")
@JoinColumn(name = "domainRepoId", referencedColumnName = "domainRepoId") @JoinColumn(name = "domainRepoId", referencedColumnName = "domainRepoId")
@EmptySetToNull
Set<DomainTransactionRecord> domainTransactionRecords; Set<DomainTransactionRecord> domainTransactionRecords;
public Set<DomainTransactionRecord> getDomainTransactionRecords() { public Set<DomainTransactionRecord> getDomainTransactionRecords() {

View file

@ -120,8 +120,8 @@ public class CollectionUtils {
* Turns an empty collection into a null collection. * Turns an empty collection into a null collection.
* *
* <p>This is unwise in the general case (nulls are bad; empties are good) but occasionally needed * <p>This is unwise in the general case (nulls are bad; empties are good) but occasionally needed
* to cause JAXB not to emit a field, or to avoid saving something to Datastore. The method name * to cause JAXB not to emit a field. The method name includes "force" to indicate that you should
* includes "force" to indicate that you should think twice before using it. * think twice before using it.
*/ */
@Nullable @Nullable
public static <T, C extends Collection<T>> C forceEmptyToNull(@Nullable C potentiallyEmpty) { public static <T, C extends Collection<T>> C forceEmptyToNull(@Nullable C potentiallyEmpty) {