From e809e967a3d4fa8580d09e0b32669bdf81c92a86 Mon Sep 17 00:00:00 2001 From: Ben McIlwain Date: Mon, 22 Apr 2024 16:25:33 -0400 Subject: [PATCH] Convert more @AutoValues to records, particularly in custom flow classes (#2408) --- .../custom/DomainCheckFlowCustomLogic.java | 123 +++++------ .../custom/DomainCreateFlowCustomLogic.java | 202 ++++++++---------- .../custom/DomainDeleteFlowCustomLogic.java | 99 ++++----- .../custom/DomainInfoFlowCustomLogic.java | 73 +++---- .../custom/DomainPricingCustomLogic.java | 169 ++++++--------- .../custom/DomainRenewFlowCustomLogic.java | 98 ++++----- .../custom/DomainUpdateFlowCustomLogic.java | 53 ++--- .../registry/flows/custom/EntityChanges.java | 38 ++-- .../AllocationTokenDomainCheckResults.java | 18 +- .../token/AllocationTokenFlowUtils.java | 8 +- .../registry/model/ForeignKeyUtils.java | 10 +- 11 files changed, 371 insertions(+), 520 deletions(-) diff --git a/core/src/main/java/google/registry/flows/custom/DomainCheckFlowCustomLogic.java b/core/src/main/java/google/registry/flows/custom/DomainCheckFlowCustomLogic.java index a32a38bd1..3331efd60 100644 --- a/core/src/main/java/google/registry/flows/custom/DomainCheckFlowCustomLogic.java +++ b/core/src/main/java/google/registry/flows/custom/DomainCheckFlowCustomLogic.java @@ -14,7 +14,7 @@ package google.registry.flows.custom; -import com.google.auto.value.AutoValue; +import com.google.auto.value.AutoBuilder; import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; import com.google.common.net.InternetDomainName; @@ -22,7 +22,6 @@ import google.registry.flows.EppException; import google.registry.flows.FlowMetadata; import google.registry.flows.SessionMetadata; import google.registry.flows.domain.DomainCheckFlow; -import google.registry.model.ImmutableObject; import google.registry.model.eppinput.EppInput; import google.registry.model.eppoutput.CheckData.DomainCheck; import google.registry.model.eppoutput.EppResponse.ResponseExtension; @@ -67,91 +66,83 @@ public class DomainCheckFlowCustomLogic extends BaseFlowCustomLogic { .build(); } - /** A class to encapsulate parameters for a call to {@link #afterValidation}. */ - @AutoValue - public abstract static class AfterValidationParameters extends ImmutableObject { - - public abstract ImmutableMap domainNames(); - - /** - * The time to perform the domain check as of. This defaults to the current time, but can be - * overridden in v>=0.12 of the fee extension. - */ - public abstract DateTime asOfDate(); + /** + * A record to encapsulate parameters for a call to {@link #afterValidation}. + * + * @param domainNames A map of the domain names being checked, from domain name as string to + * parsed value. + * @param asOfDate The time to perform the domain check as of. This defaults to the current time, + * but can be overridden in v>=0.12 of the fee extension. + */ + public record AfterValidationParameters( + ImmutableMap domainNames, DateTime asOfDate) { public static Builder newBuilder() { - return new AutoValue_DomainCheckFlowCustomLogic_AfterValidationParameters.Builder(); + return new AutoBuilder_DomainCheckFlowCustomLogic_AfterValidationParameters_Builder(); } /** Builder for {@link AfterValidationParameters}. */ - @AutoValue.Builder - public abstract static class Builder { + @AutoBuilder + public interface Builder { - public abstract Builder setDomainNames(ImmutableMap domainNames); + Builder setDomainNames(ImmutableMap domainNames); - public abstract Builder setAsOfDate(DateTime asOfDate); + Builder setAsOfDate(DateTime asOfDate); - public abstract AfterValidationParameters build(); - } - } - - /** A class to encapsulate parameters for a call to {@link #beforeResponse}. */ - @AutoValue - public abstract static class BeforeResponseParameters extends ImmutableObject { - - public abstract ImmutableList domainChecks(); - - public abstract ImmutableList responseExtensions(); - - /** - * The time to perform the domain check as of. This defaults to the current time, but can be - * overridden in v>=0.12 of the fee extension. - */ - public abstract DateTime asOfDate(); - - public static Builder newBuilder() { - return new AutoValue_DomainCheckFlowCustomLogic_BeforeResponseParameters.Builder(); - } - - /** Builder for {@link BeforeResponseParameters}. */ - @AutoValue.Builder - public abstract static class Builder { - - public abstract Builder setDomainChecks(ImmutableList domainChecks); - - public abstract Builder setResponseExtensions( - ImmutableList responseExtensions); - - public abstract Builder setAsOfDate(DateTime asOfDate); - - public abstract BeforeResponseParameters build(); + AfterValidationParameters build(); } } /** - * A class to encapsulate parameters for the return values from a call to {@link #beforeResponse}. + * A record to encapsulate parameters for a call to {@link #beforeResponse}. + * + * @param asOfDate The time to perform the domain check as of. This defaults to the current time, + * but can be overridden in v>=0.12 of the fee extension. */ - @AutoValue - public abstract static class BeforeResponseReturnData extends ImmutableObject { - - public abstract ImmutableList domainChecks(); - - public abstract ImmutableList responseExtensions(); + public record BeforeResponseParameters( + ImmutableList domainChecks, + ImmutableList responseExtensions, + DateTime asOfDate) { public static Builder newBuilder() { - return new AutoValue_DomainCheckFlowCustomLogic_BeforeResponseReturnData.Builder(); + return new AutoBuilder_DomainCheckFlowCustomLogic_BeforeResponseParameters_Builder(); + } + + /** Builder for {@link BeforeResponseParameters}. */ + @AutoBuilder + public interface Builder { + + Builder setDomainChecks(ImmutableList domainChecks); + + Builder setResponseExtensions(ImmutableList responseExtensions); + + Builder setAsOfDate(DateTime asOfDate); + + BeforeResponseParameters build(); + } + } + + /** + * A record to encapsulate parameters for the return values from a call to {@link + * #beforeResponse}. + */ + public record BeforeResponseReturnData( + ImmutableList domainChecks, + ImmutableList responseExtensions) { + + public static Builder newBuilder() { + return new AutoBuilder_DomainCheckFlowCustomLogic_BeforeResponseReturnData_Builder(); } /** Builder for {@link BeforeResponseReturnData}. */ - @AutoValue.Builder - public abstract static class Builder { + @AutoBuilder + public interface Builder { - public abstract Builder setDomainChecks(ImmutableList domainChecks); + Builder setDomainChecks(ImmutableList domainChecks); - public abstract Builder setResponseExtensions( - ImmutableList responseExtensions); + Builder setResponseExtensions(ImmutableList responseExtensions); - public abstract BeforeResponseReturnData build(); + BeforeResponseReturnData build(); } } } diff --git a/core/src/main/java/google/registry/flows/custom/DomainCreateFlowCustomLogic.java b/core/src/main/java/google/registry/flows/custom/DomainCreateFlowCustomLogic.java index 685210d3d..59f456b40 100644 --- a/core/src/main/java/google/registry/flows/custom/DomainCreateFlowCustomLogic.java +++ b/core/src/main/java/google/registry/flows/custom/DomainCreateFlowCustomLogic.java @@ -14,14 +14,13 @@ package google.registry.flows.custom; -import com.google.auto.value.AutoValue; +import com.google.auto.value.AutoBuilder; import com.google.common.collect.ImmutableList; import com.google.common.net.InternetDomainName; import google.registry.flows.EppException; import google.registry.flows.FlowMetadata; import google.registry.flows.SessionMetadata; import google.registry.flows.domain.DomainCreateFlow; -import google.registry.model.ImmutableObject; import google.registry.model.domain.Domain; import google.registry.model.eppinput.EppInput; import google.registry.model.eppoutput.EppResponse.ResponseData; @@ -81,147 +80,114 @@ public class DomainCreateFlowCustomLogic extends BaseFlowCustomLogic { .build(); } - /** A class to encapsulate parameters for a call to {@link #afterValidation}. */ - @AutoValue - public abstract static class AfterValidationParameters extends ImmutableObject { - - /** The parsed domain name of the domain that is requested to be created. */ - public abstract InternetDomainName domainName(); - - /** - * The number of years that the domain name will be registered for. - * - *

On standard TLDs, this is usually 1. - */ - public abstract int years(); - - /** - * The ID of the validated signed mark. - * - *

If a signed mark was not supplied, this value will be absent. - */ - public abstract Optional signedMarkId(); + /** + * A record to encapsulate parameters for a call to {@link #afterValidation}. + * + * @param domainName The parsed domain name of the domain that is requested to be created. + * @param years The number of years that the domain name will be registered for (typically 1). + * @param signedMarkId The ID of the validated signed mark, or absent if not supplied. + */ + public record AfterValidationParameters( + InternetDomainName domainName, int years, Optional signedMarkId) { public static Builder newBuilder() { - return new AutoValue_DomainCreateFlowCustomLogic_AfterValidationParameters.Builder(); + return new AutoBuilder_DomainCreateFlowCustomLogic_AfterValidationParameters_Builder(); } /** Builder for {@link AfterValidationParameters}. */ - @AutoValue.Builder - public abstract static class Builder { + @AutoBuilder + public interface Builder { - public abstract Builder setDomainName(InternetDomainName domainName); + Builder setDomainName(InternetDomainName domainName); - public abstract Builder setYears(int years); + Builder setYears(int years); - public abstract Builder setSignedMarkId(Optional signedMarkId); + Builder setSignedMarkId(Optional signedMarkId); - public abstract AfterValidationParameters build(); - } - } - - /** A class to encapsulate parameters for a call to {@link #beforeSave}. */ - @AutoValue - public abstract static class BeforeSaveParameters extends ImmutableObject { - - /** - * The new {@link Domain} entity that is going to be persisted at the end of the transaction. - */ - public abstract Domain newDomain(); - - /** - * The new {@link HistoryEntry} entity for the domain's creation that is going to be persisted - * at the end of the transaction. - */ - public abstract HistoryEntry historyEntry(); - - /** - * The collection of {@link EntityChanges} (including new entities and those to delete) that - * will be persisted at the end of the transaction. - * - *

Note that the new domain and history entry are also included as saves in this collection, - * and are separated out above solely for convenience, as they are most likely to need to be - * changed. Removing them from the collection will cause them not to be saved, which is most - * likely not what you intended. - */ - public abstract EntityChanges entityChanges(); - - /** - * The number of years that the domain name will be registered for. - * - *

On standard TLDs, this is usually 1. - */ - public abstract int years(); - - public static Builder newBuilder() { - return new AutoValue_DomainCreateFlowCustomLogic_BeforeSaveParameters.Builder(); - } - - /** Builder for {@link BeforeSaveParameters}. */ - @AutoValue.Builder - public abstract static class Builder { - - public abstract Builder setNewDomain(Domain newDomain); - - public abstract Builder setHistoryEntry(HistoryEntry historyEntry); - - public abstract Builder setEntityChanges(EntityChanges entityChanges); - - public abstract Builder setYears(int years); - - public abstract BeforeSaveParameters build(); - } - } - - /** A class to encapsulate parameters for a call to {@link #beforeResponse}. */ - @AutoValue - public abstract static class BeforeResponseParameters extends ImmutableObject { - - public abstract ResponseData resData(); - - public abstract ImmutableList responseExtensions(); - - public static BeforeResponseParameters.Builder newBuilder() { - return new AutoValue_DomainCreateFlowCustomLogic_BeforeResponseParameters.Builder(); - } - - /** Builder for {@link DomainCreateFlowCustomLogic.BeforeResponseParameters}. */ - @AutoValue.Builder - public abstract static class Builder { - - public abstract BeforeResponseParameters.Builder setResData(ResponseData resData); - - public abstract BeforeResponseParameters.Builder setResponseExtensions( - ImmutableList responseExtensions); - - public abstract BeforeResponseParameters build(); + AfterValidationParameters build(); } } /** - * A class to encapsulate parameters for the return values from a call to {@link #beforeResponse}. + * A record to encapsulate parameters for a call to {@link #beforeSave}. + * + * @param newDomain The new {@link Domain} entity that is going to be persisted at the end of the + * transaction. + * @param historyEntry The new {@link HistoryEntry} entity for the domain's creation that is going + * to be persisted at the end of the transaction. + * @param entityChanges The collection of {@link EntityChanges} (including new entities and those + * to delete) that will be persisted at the end of the transaction. + *

Note that the new domain and history entry are also included as saves in this + * collection, and are separated out above solely for convenience, as they are most likely to + * need to be changed. Removing them from the collection will cause them not to be saved, + * which is most likely not what you intended. + * @param years The number of years that the domain name will be registered for (typically 1). */ - @AutoValue - public abstract static class BeforeResponseReturnData extends ImmutableObject { + public record BeforeSaveParameters( + Domain newDomain, HistoryEntry historyEntry, EntityChanges entityChanges, int years) { - public abstract ResponseData resData(); + public static Builder newBuilder() { + return new AutoBuilder_DomainCreateFlowCustomLogic_BeforeSaveParameters_Builder(); + } - public abstract ImmutableList responseExtensions(); + /** Builder for {@link BeforeSaveParameters}. */ + @AutoBuilder + public interface Builder { + + Builder setNewDomain(Domain newDomain); + + Builder setHistoryEntry(HistoryEntry historyEntry); + + Builder setEntityChanges(EntityChanges entityChanges); + + Builder setYears(int years); + + BeforeSaveParameters build(); + } + } + + /** A record to encapsulate parameters for a call to {@link #beforeResponse}. */ + public record BeforeResponseParameters( + ResponseData resData, ImmutableList responseExtensions) { + + public static BeforeResponseParameters.Builder newBuilder() { + return new AutoBuilder_DomainCreateFlowCustomLogic_BeforeResponseParameters_Builder(); + } + + /** Builder for {@link DomainCreateFlowCustomLogic.BeforeResponseParameters}. */ + @AutoBuilder + public interface Builder { + + BeforeResponseParameters.Builder setResData(ResponseData resData); + + BeforeResponseParameters.Builder setResponseExtensions( + ImmutableList responseExtensions); + + BeforeResponseParameters build(); + } + } + + /** + * A record to encapsulate parameters for the return values from a call to {@link + * #beforeResponse}. + */ + public record BeforeResponseReturnData( + ResponseData resData, ImmutableList responseExtensions) { public static BeforeResponseReturnData.Builder newBuilder() { - return new AutoValue_DomainCreateFlowCustomLogic_BeforeResponseReturnData.Builder(); + return new AutoBuilder_DomainCreateFlowCustomLogic_BeforeResponseReturnData_Builder(); } /** Builder for {@link DomainCreateFlowCustomLogic.BeforeResponseReturnData}. */ - @AutoValue.Builder - public abstract static class Builder { + @AutoBuilder + public interface Builder { - public abstract BeforeResponseReturnData.Builder setResData(ResponseData resData); + BeforeResponseReturnData.Builder setResData(ResponseData resData); - public abstract BeforeResponseReturnData.Builder setResponseExtensions( + BeforeResponseReturnData.Builder setResponseExtensions( ImmutableList responseExtensions); - public abstract BeforeResponseReturnData build(); + BeforeResponseReturnData build(); } } } diff --git a/core/src/main/java/google/registry/flows/custom/DomainDeleteFlowCustomLogic.java b/core/src/main/java/google/registry/flows/custom/DomainDeleteFlowCustomLogic.java index a1f3ced20..81504c611 100644 --- a/core/src/main/java/google/registry/flows/custom/DomainDeleteFlowCustomLogic.java +++ b/core/src/main/java/google/registry/flows/custom/DomainDeleteFlowCustomLogic.java @@ -14,13 +14,12 @@ package google.registry.flows.custom; -import com.google.auto.value.AutoValue; +import com.google.auto.value.AutoBuilder; import com.google.common.collect.ImmutableList; import google.registry.flows.EppException; import google.registry.flows.FlowMetadata; import google.registry.flows.SessionMetadata; import google.registry.flows.domain.DomainDeleteFlow; -import google.registry.model.ImmutableObject; import google.registry.model.domain.Domain; import google.registry.model.eppinput.EppInput; import google.registry.model.eppoutput.EppResponse.ResponseExtension; @@ -79,112 +78,96 @@ public class DomainDeleteFlowCustomLogic extends BaseFlowCustomLogic { .build(); } - /** A class to encapsulate parameters for a call to {@link #afterValidation}. */ - @AutoValue - public abstract static class AfterValidationParameters extends ImmutableObject { - - public abstract Domain existingDomain(); + /** A record to encapsulate parameters for a call to {@link #afterValidation}. */ + public record AfterValidationParameters(Domain existingDomain) { public static Builder newBuilder() { - return new AutoValue_DomainDeleteFlowCustomLogic_AfterValidationParameters.Builder(); + return new AutoBuilder_DomainDeleteFlowCustomLogic_AfterValidationParameters_Builder(); } /** Builder for {@link AfterValidationParameters}. */ - @AutoValue.Builder - public abstract static class Builder { + @AutoBuilder + public interface Builder { - public abstract Builder setExistingDomain(Domain existingDomain); + Builder setExistingDomain(Domain existingDomain); - public abstract AfterValidationParameters build(); + AfterValidationParameters build(); } } /** - * A class to encapsulate parameters for a call to {@link #beforeSave}. + * A record to encapsulate parameters for a call to {@link #beforeSave}. * *

Note that both newDomain and historyEntry are included in entityChanges. They are also * passed separately for convenience, but they are the same instance, and changes to them will * also affect what is persisted from entityChanges. */ - @AutoValue - public abstract static class BeforeSaveParameters extends ImmutableObject { - - public abstract Domain existingDomain(); - - public abstract Domain newDomain(); - - public abstract HistoryEntry historyEntry(); - - public abstract EntityChanges entityChanges(); + public record BeforeSaveParameters( + Domain existingDomain, + Domain newDomain, + HistoryEntry historyEntry, + EntityChanges entityChanges) { public static Builder newBuilder() { - return new AutoValue_DomainDeleteFlowCustomLogic_BeforeSaveParameters.Builder(); + return new AutoBuilder_DomainDeleteFlowCustomLogic_BeforeSaveParameters_Builder(); } /** Builder for {@link BeforeSaveParameters}. */ - @AutoValue.Builder - public abstract static class Builder { + @AutoBuilder + public interface Builder { - public abstract Builder setExistingDomain(Domain existingDomain); + Builder setExistingDomain(Domain existingDomain); - public abstract Builder setNewDomain(Domain newDomain); + Builder setNewDomain(Domain newDomain); - public abstract Builder setHistoryEntry(HistoryEntry historyEntry); + Builder setHistoryEntry(HistoryEntry historyEntry); - public abstract Builder setEntityChanges(EntityChanges entityChanges); + Builder setEntityChanges(EntityChanges entityChanges); - public abstract BeforeSaveParameters build(); + BeforeSaveParameters build(); } } - /** A class to encapsulate parameters for a call to {@link #beforeResponse}. */ - @AutoValue - public abstract static class BeforeResponseParameters extends ImmutableObject { - public abstract Result.Code resultCode(); - - public abstract ImmutableList responseExtensions(); + /** A record to encapsulate parameters for a call to {@link #beforeResponse}. */ + public record BeforeResponseParameters( + Result.Code resultCode, ImmutableList responseExtensions) { public static Builder newBuilder() { - return new AutoValue_DomainDeleteFlowCustomLogic_BeforeResponseParameters.Builder(); + return new AutoBuilder_DomainDeleteFlowCustomLogic_BeforeResponseParameters_Builder(); } /** Builder for {@link BeforeResponseParameters}. */ - @AutoValue.Builder - public abstract static class Builder { + @AutoBuilder + public interface Builder { - public abstract Builder setResultCode(Result.Code resultCode); + Builder setResultCode(Result.Code resultCode); - public abstract Builder setResponseExtensions( - ImmutableList responseExtensions); + Builder setResponseExtensions(ImmutableList responseExtensions); - public abstract BeforeResponseParameters build(); + BeforeResponseParameters build(); } } /** - * A class to encapsulate parameters for the return values from a call to {@link #beforeResponse}. + * A record to encapsulate parameters for the return values from a call to {@link + * #beforeResponse}. */ - @AutoValue - public abstract static class BeforeResponseReturnData extends ImmutableObject { - - public abstract Result.Code resultCode(); - - public abstract ImmutableList responseExtensions(); + public record BeforeResponseReturnData( + Result.Code resultCode, ImmutableList responseExtensions) { public static Builder newBuilder() { - return new AutoValue_DomainDeleteFlowCustomLogic_BeforeResponseReturnData.Builder(); + return new AutoBuilder_DomainDeleteFlowCustomLogic_BeforeResponseReturnData_Builder(); } /** Builder for {@link BeforeResponseReturnData}. */ - @AutoValue.Builder - public abstract static class Builder { + @AutoBuilder + public interface Builder { - public abstract Builder setResultCode(Result.Code resultCode); + Builder setResultCode(Result.Code resultCode); - public abstract Builder setResponseExtensions( - ImmutableList responseExtensions); + Builder setResponseExtensions(ImmutableList responseExtensions); - public abstract BeforeResponseReturnData build(); + BeforeResponseReturnData build(); } } } diff --git a/core/src/main/java/google/registry/flows/custom/DomainInfoFlowCustomLogic.java b/core/src/main/java/google/registry/flows/custom/DomainInfoFlowCustomLogic.java index d8af13495..b6e948850 100644 --- a/core/src/main/java/google/registry/flows/custom/DomainInfoFlowCustomLogic.java +++ b/core/src/main/java/google/registry/flows/custom/DomainInfoFlowCustomLogic.java @@ -14,13 +14,12 @@ package google.registry.flows.custom; -import com.google.auto.value.AutoValue; +import com.google.auto.value.AutoBuilder; import com.google.common.collect.ImmutableList; import google.registry.flows.EppException; import google.registry.flows.FlowMetadata; import google.registry.flows.SessionMetadata; import google.registry.flows.domain.DomainInfoFlow; -import google.registry.model.ImmutableObject; import google.registry.model.domain.Domain; import google.registry.model.domain.DomainInfoData; import google.registry.model.eppinput.EppInput; @@ -65,79 +64,67 @@ public class DomainInfoFlowCustomLogic extends BaseFlowCustomLogic { .build(); } - /** A class to encapsulate parameters for a call to {@link #afterValidation}. */ - @AutoValue - public abstract static class AfterValidationParameters extends ImmutableObject { - - public abstract Domain domain(); + /** A record to encapsulate parameters for a call to {@link #afterValidation}. */ + public record AfterValidationParameters(Domain domain) { public static Builder newBuilder() { - return new AutoValue_DomainInfoFlowCustomLogic_AfterValidationParameters.Builder(); + return new AutoBuilder_DomainInfoFlowCustomLogic_AfterValidationParameters_Builder(); } /** Builder for {@link AfterValidationParameters}. */ - @AutoValue.Builder - public abstract static class Builder { + @AutoBuilder + public interface Builder { - public abstract Builder setDomain(Domain domain); + Builder setDomain(Domain domain); - public abstract AfterValidationParameters build(); + AfterValidationParameters build(); } } - /** A class to encapsulate parameters for a call to {@link #beforeResponse}. */ - @AutoValue - public abstract static class BeforeResponseParameters extends ImmutableObject { - - public abstract Domain domain(); - - public abstract DomainInfoData resData(); - - public abstract ImmutableList responseExtensions(); + /** A record to encapsulate parameters for a call to {@link #beforeResponse}. */ + public record BeforeResponseParameters( + Domain domain, + DomainInfoData resData, + ImmutableList responseExtensions) { public static Builder newBuilder() { - return new AutoValue_DomainInfoFlowCustomLogic_BeforeResponseParameters.Builder(); + return new AutoBuilder_DomainInfoFlowCustomLogic_BeforeResponseParameters_Builder(); } /** Builder for {@link BeforeResponseParameters}. */ - @AutoValue.Builder - public abstract static class Builder { + @AutoBuilder + public interface Builder { - public abstract Builder setDomain(Domain domain); + Builder setDomain(Domain domain); - public abstract Builder setResData(DomainInfoData resData); + Builder setResData(DomainInfoData resData); - public abstract Builder setResponseExtensions( - ImmutableList responseExtensions); + Builder setResponseExtensions(ImmutableList responseExtensions); - public abstract BeforeResponseParameters build(); + BeforeResponseParameters build(); } } /** - * A class to encapsulate parameters for the return values from a call to {@link #beforeResponse}. + * A record to encapsulate parameters for the return values from a call to {@link + * #beforeResponse}. */ - @AutoValue - public abstract static class BeforeResponseReturnData extends ImmutableObject { - - public abstract DomainInfoData resData(); - - public abstract ImmutableList responseExtensions(); + public record BeforeResponseReturnData( + DomainInfoData resData, ImmutableList responseExtensions) { public static Builder newBuilder() { - return new AutoValue_DomainInfoFlowCustomLogic_BeforeResponseReturnData.Builder(); + return new AutoBuilder_DomainInfoFlowCustomLogic_BeforeResponseReturnData_Builder(); } /** Builder for {@link BeforeResponseReturnData}. */ - @AutoValue.Builder - public abstract static class Builder { + @AutoBuilder + public interface Builder { - public abstract Builder setResData(DomainInfoData resData); + Builder setResData(DomainInfoData resData); - public abstract Builder setResponseExtensions( - ImmutableList responseExtensions); + Builder setResponseExtensions(ImmutableList responseExtensions); - public abstract BeforeResponseReturnData build(); + BeforeResponseReturnData build(); } } } diff --git a/core/src/main/java/google/registry/flows/custom/DomainPricingCustomLogic.java b/core/src/main/java/google/registry/flows/custom/DomainPricingCustomLogic.java index 2b3916d31..0bace0486 100644 --- a/core/src/main/java/google/registry/flows/custom/DomainPricingCustomLogic.java +++ b/core/src/main/java/google/registry/flows/custom/DomainPricingCustomLogic.java @@ -14,14 +14,13 @@ package google.registry.flows.custom; -import com.google.auto.value.AutoValue; +import com.google.auto.value.AutoBuilder; import com.google.common.net.InternetDomainName; import google.registry.flows.EppException; import google.registry.flows.FlowMetadata; import google.registry.flows.SessionMetadata; import google.registry.flows.domain.DomainPricingLogic; import google.registry.flows.domain.FeesAndCredits; -import google.registry.model.ImmutableObject; import google.registry.model.eppinput.EppInput; import google.registry.model.tld.Tld; import javax.annotation.Nullable; @@ -75,171 +74,135 @@ public class DomainPricingCustomLogic extends BaseFlowCustomLogic { return priceParameters.feesAndCredits(); } - /** A class to encapsulate parameters for a call to {@link #customizeCreatePrice} . */ - @AutoValue - public abstract static class CreatePriceParameters extends ImmutableObject { - - public abstract FeesAndCredits feesAndCredits(); - - public abstract Tld tld(); - - public abstract InternetDomainName domainName(); - - public abstract DateTime asOfDate(); - - public abstract int years(); + /** A record to encapsulate parameters for a call to {@link #customizeCreatePrice} . */ + public record CreatePriceParameters( + FeesAndCredits feesAndCredits, + Tld tld, + InternetDomainName domainName, + DateTime asOfDate, + int years) { public static Builder newBuilder() { - return new AutoValue_DomainPricingCustomLogic_CreatePriceParameters.Builder(); + return new AutoBuilder_DomainPricingCustomLogic_CreatePriceParameters_Builder(); } /** Builder for {@link CreatePriceParameters}. */ - @AutoValue.Builder - public abstract static class Builder { + @AutoBuilder + public interface Builder { - public abstract Builder setFeesAndCredits(FeesAndCredits feesAndCredits); + Builder setFeesAndCredits(FeesAndCredits feesAndCredits); - public abstract Builder setTld(Tld tld); + Builder setTld(Tld tld); - public abstract Builder setDomainName(InternetDomainName domainName); + Builder setDomainName(InternetDomainName domainName); - public abstract Builder setAsOfDate(DateTime asOfDate); + Builder setAsOfDate(DateTime asOfDate); - public abstract Builder setYears(int years); + Builder setYears(int years); - public abstract CreatePriceParameters build(); + CreatePriceParameters build(); } } - /** A class to encapsulate parameters for a call to {@link #customizeRenewPrice} . */ - @AutoValue - public abstract static class RenewPriceParameters extends ImmutableObject { - - public abstract FeesAndCredits feesAndCredits(); - - public abstract Tld tld(); - - public abstract InternetDomainName domainName(); - - public abstract DateTime asOfDate(); - - public abstract int years(); + /** A record to encapsulate parameters for a call to {@link #customizeRenewPrice} . */ + public record RenewPriceParameters( + FeesAndCredits feesAndCredits, + Tld tld, + InternetDomainName domainName, + DateTime asOfDate, + int years) { public static Builder newBuilder() { - return new AutoValue_DomainPricingCustomLogic_RenewPriceParameters.Builder(); + return new AutoBuilder_DomainPricingCustomLogic_RenewPriceParameters_Builder(); } /** Builder for {@link RenewPriceParameters}. */ - @AutoValue.Builder - public abstract static class Builder { + @AutoBuilder + public interface Builder { - public abstract Builder setFeesAndCredits(FeesAndCredits feesAndCredits); + Builder setFeesAndCredits(FeesAndCredits feesAndCredits); - public abstract Builder setTld(Tld tld); + Builder setTld(Tld tld); - public abstract Builder setDomainName(InternetDomainName domainName); + Builder setDomainName(InternetDomainName domainName); - public abstract Builder setAsOfDate(DateTime asOfDate); + Builder setAsOfDate(DateTime asOfDate); - public abstract Builder setYears(int years); + Builder setYears(int years); - public abstract RenewPriceParameters build(); + RenewPriceParameters build(); } } - /** A class to encapsulate parameters for a call to {@link #customizeRestorePrice} . */ - @AutoValue - public abstract static class RestorePriceParameters extends ImmutableObject { - - public abstract FeesAndCredits feesAndCredits(); - - public abstract Tld tld(); - - public abstract InternetDomainName domainName(); - - public abstract DateTime asOfDate(); + /** A record to encapsulate parameters for a call to {@link #customizeRestorePrice} . */ + public record RestorePriceParameters( + FeesAndCredits feesAndCredits, Tld tld, InternetDomainName domainName, DateTime asOfDate) { public static Builder newBuilder() { - return new AutoValue_DomainPricingCustomLogic_RestorePriceParameters.Builder(); + return new AutoBuilder_DomainPricingCustomLogic_RestorePriceParameters_Builder(); } /** Builder for {@link RestorePriceParameters}. */ - @AutoValue.Builder - public abstract static class Builder { + @AutoBuilder + public interface Builder { - public abstract Builder setFeesAndCredits(FeesAndCredits feesAndCredits); + Builder setFeesAndCredits(FeesAndCredits feesAndCredits); - public abstract Builder setTld(Tld tld); + Builder setTld(Tld tld); - public abstract Builder setDomainName(InternetDomainName domainName); + Builder setDomainName(InternetDomainName domainName); - public abstract Builder setAsOfDate(DateTime asOfDate); + Builder setAsOfDate(DateTime asOfDate); - public abstract RestorePriceParameters build(); + RestorePriceParameters build(); } } - /** A class to encapsulate parameters for a call to {@link #customizeTransferPrice} . */ - @AutoValue - public abstract static class TransferPriceParameters extends ImmutableObject { - - public abstract FeesAndCredits feesAndCredits(); - - public abstract Tld tld(); - - public abstract InternetDomainName domainName(); - - public abstract DateTime asOfDate(); + /** A record to encapsulate parameters for a call to {@link #customizeTransferPrice} . */ + public record TransferPriceParameters( + FeesAndCredits feesAndCredits, Tld tld, InternetDomainName domainName, DateTime asOfDate) { public static Builder newBuilder() { - return new AutoValue_DomainPricingCustomLogic_TransferPriceParameters.Builder(); + return new AutoBuilder_DomainPricingCustomLogic_TransferPriceParameters_Builder(); } /** Builder for {@link TransferPriceParameters}. */ - @AutoValue.Builder - public abstract static class Builder { + @AutoBuilder + public interface Builder { - public abstract Builder setFeesAndCredits(FeesAndCredits feesAndCredits); + Builder setFeesAndCredits(FeesAndCredits feesAndCredits); - public abstract Builder setTld(Tld tld); + Builder setTld(Tld tld); - public abstract Builder setDomainName(InternetDomainName domainName); + Builder setDomainName(InternetDomainName domainName); - public abstract Builder setAsOfDate(DateTime asOfDate); + Builder setAsOfDate(DateTime asOfDate); - public abstract TransferPriceParameters build(); + TransferPriceParameters build(); } } - /** A class to encapsulate parameters for a call to {@link #customizeUpdatePrice} . */ - @AutoValue - public abstract static class UpdatePriceParameters extends ImmutableObject { - - public abstract FeesAndCredits feesAndCredits(); - - public abstract Tld tld(); - - public abstract InternetDomainName domainName(); - - public abstract DateTime asOfDate(); + /** A record to encapsulate parameters for a call to {@link #customizeUpdatePrice} . */ + public record UpdatePriceParameters( + FeesAndCredits feesAndCredits, Tld tld, InternetDomainName domainName, DateTime asOfDate) { public static Builder newBuilder() { - return new AutoValue_DomainPricingCustomLogic_UpdatePriceParameters.Builder(); + return new AutoBuilder_DomainPricingCustomLogic_UpdatePriceParameters_Builder(); } /** Builder for {@link UpdatePriceParameters}. */ - @AutoValue.Builder - public abstract static class Builder { + @AutoBuilder + public interface Builder { - public abstract Builder setFeesAndCredits(FeesAndCredits feesAndCredits); + Builder setFeesAndCredits(FeesAndCredits feesAndCredits); - public abstract Builder setTld(Tld tld); + Builder setTld(Tld tld); - public abstract Builder setDomainName(InternetDomainName domainName); + Builder setDomainName(InternetDomainName domainName); - public abstract Builder setAsOfDate(DateTime asOfDate); + Builder setAsOfDate(DateTime asOfDate); - public abstract UpdatePriceParameters build(); + UpdatePriceParameters build(); } } } diff --git a/core/src/main/java/google/registry/flows/custom/DomainRenewFlowCustomLogic.java b/core/src/main/java/google/registry/flows/custom/DomainRenewFlowCustomLogic.java index 667c2b8ef..d02ff1638 100644 --- a/core/src/main/java/google/registry/flows/custom/DomainRenewFlowCustomLogic.java +++ b/core/src/main/java/google/registry/flows/custom/DomainRenewFlowCustomLogic.java @@ -15,13 +15,11 @@ package google.registry.flows.custom; import com.google.auto.value.AutoBuilder; -import com.google.auto.value.AutoValue; import com.google.common.collect.ImmutableList; import google.registry.flows.EppException; import google.registry.flows.FlowMetadata; import google.registry.flows.SessionMetadata; import google.registry.flows.domain.DomainRenewFlow; -import google.registry.model.ImmutableObject; import google.registry.model.domain.Domain; import google.registry.model.eppinput.EppInput; import google.registry.model.eppoutput.EppResponse.ResponseData; @@ -103,103 +101,89 @@ public class DomainRenewFlowCustomLogic extends BaseFlowCustomLogic { } /** - * A class to encapsulate parameters for a call to {@link #beforeSave}. + * A record to encapsulate parameters for a call to {@link #beforeSave}. * *

Note that both newDomain and historyEntry are included in entityChanges. They are also * passed separately for convenience, but they are the same instance, and changes to them will * also affect what is persisted from entityChanges. */ - @AutoValue - public abstract static class BeforeSaveParameters extends ImmutableObject { - - public abstract Domain existingDomain(); - - public abstract Domain newDomain(); - - public abstract HistoryEntry historyEntry(); - - public abstract EntityChanges entityChanges(); - - public abstract int years(); - - public abstract DateTime now(); + public record BeforeSaveParameters( + Domain existingDomain, + Domain newDomain, + HistoryEntry historyEntry, + EntityChanges entityChanges, + int years, + DateTime now) { public static Builder newBuilder() { - return new AutoValue_DomainRenewFlowCustomLogic_BeforeSaveParameters.Builder(); + return new AutoBuilder_DomainRenewFlowCustomLogic_BeforeSaveParameters_Builder(); } /** Builder for {@link BeforeSaveParameters}. */ - @AutoValue.Builder - public abstract static class Builder { + @AutoBuilder + public interface Builder { - public abstract Builder setExistingDomain(Domain existingDomain); + Builder setExistingDomain(Domain existingDomain); - public abstract Builder setNewDomain(Domain newDomain); + Builder setNewDomain(Domain newDomain); - public abstract Builder setHistoryEntry(HistoryEntry historyEntry); + Builder setHistoryEntry(HistoryEntry historyEntry); - public abstract Builder setEntityChanges(EntityChanges entityChanges); + Builder setEntityChanges(EntityChanges entityChanges); - public abstract Builder setYears(int years); + Builder setYears(int years); - public abstract Builder setNow(DateTime now); + Builder setNow(DateTime now); - public abstract BeforeSaveParameters build(); + BeforeSaveParameters build(); } } - /** A class to encapsulate parameters for a call to {@link #beforeResponse}. */ - @AutoValue - public abstract static class BeforeResponseParameters extends ImmutableObject { - - public abstract Domain domain(); - - public abstract ResponseData resData(); - - public abstract ImmutableList responseExtensions(); + /** A record to encapsulate parameters for a call to {@link #beforeResponse}. */ + public record BeforeResponseParameters( + Domain domain, + ResponseData resData, + ImmutableList responseExtensions) { public static BeforeResponseParameters.Builder newBuilder() { - return new AutoValue_DomainRenewFlowCustomLogic_BeforeResponseParameters.Builder(); + return new AutoBuilder_DomainRenewFlowCustomLogic_BeforeResponseParameters_Builder(); } /** Builder for {@link BeforeResponseParameters}. */ - @AutoValue.Builder - public abstract static class Builder { + @AutoBuilder + public interface Builder { - public abstract BeforeResponseParameters.Builder setDomain(Domain domain); + BeforeResponseParameters.Builder setDomain(Domain domain); - public abstract BeforeResponseParameters.Builder setResData(ResponseData resData); + BeforeResponseParameters.Builder setResData(ResponseData resData); - public abstract BeforeResponseParameters.Builder setResponseExtensions( + BeforeResponseParameters.Builder setResponseExtensions( ImmutableList responseExtensions); - public abstract BeforeResponseParameters build(); + BeforeResponseParameters build(); } } + /** - * A class to encapsulate parameters for the return values from a call to {@link #beforeResponse}. + * A record to encapsulate parameters for the return values from a call to {@link + * #beforeResponse}. */ - @AutoValue - public abstract static class BeforeResponseReturnData extends ImmutableObject { - - public abstract ResponseData resData(); - - public abstract ImmutableList responseExtensions(); + public record BeforeResponseReturnData( + ResponseData resData, ImmutableList responseExtensions) { public static Builder newBuilder() { - return new AutoValue_DomainRenewFlowCustomLogic_BeforeResponseReturnData.Builder(); + return new AutoBuilder_DomainRenewFlowCustomLogic_BeforeResponseReturnData_Builder(); } /** Builder for {@link BeforeResponseReturnData}. */ - @AutoValue.Builder - public abstract static class Builder { + @AutoBuilder + public interface Builder { - public abstract Builder setResData(ResponseData resData); + Builder setResData(ResponseData resData); - public abstract Builder setResponseExtensions( - ImmutableList responseExtensions); + Builder setResponseExtensions(ImmutableList responseExtensions); - public abstract BeforeResponseReturnData build(); + BeforeResponseReturnData build(); } } } diff --git a/core/src/main/java/google/registry/flows/custom/DomainUpdateFlowCustomLogic.java b/core/src/main/java/google/registry/flows/custom/DomainUpdateFlowCustomLogic.java index 4bc8eef58..662c8e134 100644 --- a/core/src/main/java/google/registry/flows/custom/DomainUpdateFlowCustomLogic.java +++ b/core/src/main/java/google/registry/flows/custom/DomainUpdateFlowCustomLogic.java @@ -14,12 +14,11 @@ package google.registry.flows.custom; -import com.google.auto.value.AutoValue; +import com.google.auto.value.AutoBuilder; import google.registry.flows.EppException; import google.registry.flows.FlowMetadata; import google.registry.flows.SessionMetadata; import google.registry.flows.domain.DomainUpdateFlow; -import google.registry.model.ImmutableObject; import google.registry.model.domain.Domain; import google.registry.model.eppinput.EppInput; import google.registry.model.reporting.HistoryEntry; @@ -61,61 +60,53 @@ public class DomainUpdateFlowCustomLogic extends BaseFlowCustomLogic { return parameters.entityChanges(); } - /** A class to encapsulate parameters for a call to {@link #afterValidation}. */ - @AutoValue - public abstract static class AfterValidationParameters extends ImmutableObject { - - public abstract Domain existingDomain(); + /** A record to encapsulate parameters for a call to {@link #afterValidation}. */ + public record AfterValidationParameters(Domain existingDomain) { public static Builder newBuilder() { - return new AutoValue_DomainUpdateFlowCustomLogic_AfterValidationParameters.Builder(); + return new AutoBuilder_DomainUpdateFlowCustomLogic_AfterValidationParameters_Builder(); } /** Builder for {@link AfterValidationParameters}. */ - @AutoValue.Builder - public abstract static class Builder { + @AutoBuilder + public interface Builder { - public abstract Builder setExistingDomain(Domain existingDomain); + Builder setExistingDomain(Domain existingDomain); - public abstract AfterValidationParameters build(); + AfterValidationParameters build(); } } /** - * A class to encapsulate parameters for a call to {@link #beforeSave}. + * A record to encapsulate parameters for a call to {@link #beforeSave}. * *

Note that both newDomain and historyEntry are included in entityChanges. They are also * passed separately for convenience, but they are the same instance, and changes to them will * also affect what is persisted from entityChanges. */ - @AutoValue - public abstract static class BeforeSaveParameters extends ImmutableObject { - - public abstract Domain existingDomain(); - - public abstract Domain newDomain(); - - public abstract HistoryEntry historyEntry(); - - public abstract EntityChanges entityChanges(); + public record BeforeSaveParameters( + Domain existingDomain, + Domain newDomain, + HistoryEntry historyEntry, + EntityChanges entityChanges) { public static Builder newBuilder() { - return new AutoValue_DomainUpdateFlowCustomLogic_BeforeSaveParameters.Builder(); + return new AutoBuilder_DomainUpdateFlowCustomLogic_BeforeSaveParameters_Builder(); } /** Builder for {@link BeforeSaveParameters}. */ - @AutoValue.Builder - public abstract static class Builder { + @AutoBuilder + public interface Builder { - public abstract Builder setExistingDomain(Domain existingDomain); + Builder setExistingDomain(Domain existingDomain); - public abstract Builder setNewDomain(Domain newDomain); + Builder setNewDomain(Domain newDomain); - public abstract Builder setHistoryEntry(HistoryEntry historyEntry); + Builder setHistoryEntry(HistoryEntry historyEntry); - public abstract Builder setEntityChanges(EntityChanges entityChanges); + Builder setEntityChanges(EntityChanges entityChanges); - public abstract BeforeSaveParameters build(); + BeforeSaveParameters build(); } } } diff --git a/core/src/main/java/google/registry/flows/custom/EntityChanges.java b/core/src/main/java/google/registry/flows/custom/EntityChanges.java index ea4acaa37..00cac1567 100644 --- a/core/src/main/java/google/registry/flows/custom/EntityChanges.java +++ b/core/src/main/java/google/registry/flows/custom/EntityChanges.java @@ -14,49 +14,55 @@ package google.registry.flows.custom; -import com.google.auto.value.AutoValue; +import com.google.auto.value.AutoBuilder; import com.google.common.collect.ImmutableSet; import google.registry.model.ImmutableObject; import google.registry.persistence.VKey; -/** A wrapper class that encapsulates database entities to both save and delete. */ -@AutoValue -public abstract class EntityChanges { +/** A record that encapsulates database entities to both save and delete. */ +public record EntityChanges( + ImmutableSet saves, ImmutableSet> deletes) { - public abstract ImmutableSet getSaves(); + public ImmutableSet getSaves() { + return saves; + } + ; - public abstract ImmutableSet> getDeletes(); + public ImmutableSet> getDeletes() { + return deletes; + } + ; public static Builder newBuilder() { // Default both entities to save and entities to delete to empty sets, so that the build() // method won't subsequently throw an exception if one doesn't end up being applicable. - return new AutoValue_EntityChanges.Builder() + return new AutoBuilder_EntityChanges_Builder() .setSaves(ImmutableSet.of()) .setDeletes(ImmutableSet.of()); } /** Builder for {@link EntityChanges}. */ - @AutoValue.Builder - public abstract static class Builder { + @AutoBuilder + public interface Builder { - public abstract Builder setSaves(ImmutableSet entitiesToSave); + Builder setSaves(ImmutableSet entitiesToSave); - public abstract ImmutableSet.Builder savesBuilder(); + ImmutableSet.Builder savesBuilder(); - public Builder addSave(ImmutableObject entityToSave) { + default Builder addSave(ImmutableObject entityToSave) { savesBuilder().add(entityToSave); return this; } - public abstract Builder setDeletes(ImmutableSet> entitiesToDelete); + Builder setDeletes(ImmutableSet> entitiesToDelete); - public abstract ImmutableSet.Builder> deletesBuilder(); + ImmutableSet.Builder> deletesBuilder(); - public Builder addDelete(VKey entityToDelete) { + default Builder addDelete(VKey entityToDelete) { deletesBuilder().add(entityToDelete); return this; } - public abstract EntityChanges build(); + EntityChanges build(); } } diff --git a/core/src/main/java/google/registry/flows/domain/token/AllocationTokenDomainCheckResults.java b/core/src/main/java/google/registry/flows/domain/token/AllocationTokenDomainCheckResults.java index 9b695d16b..a2455f0f8 100644 --- a/core/src/main/java/google/registry/flows/domain/token/AllocationTokenDomainCheckResults.java +++ b/core/src/main/java/google/registry/flows/domain/token/AllocationTokenDomainCheckResults.java @@ -14,23 +14,11 @@ package google.registry.flows.domain.token; -import com.google.auto.value.AutoValue; import com.google.common.collect.ImmutableMap; import com.google.common.net.InternetDomainName; import google.registry.model.domain.token.AllocationToken; import java.util.Optional; -/** Value class to represent the result of loading a token and checking domains with it. */ -@AutoValue -public abstract class AllocationTokenDomainCheckResults { - - public abstract Optional token(); - - public abstract ImmutableMap domainCheckResults(); - - public static AllocationTokenDomainCheckResults create( - Optional allocationToken, - ImmutableMap domainCheckResults) { - return new AutoValue_AllocationTokenDomainCheckResults(allocationToken, domainCheckResults); - } -} +/** Record to represent the result of loading a token and checking domains with it. */ +public record AllocationTokenDomainCheckResults( + Optional token, ImmutableMap domainCheckResults) {} diff --git a/core/src/main/java/google/registry/flows/domain/token/AllocationTokenFlowUtils.java b/core/src/main/java/google/registry/flows/domain/token/AllocationTokenFlowUtils.java index c7b084ab5..7ffd65fbf 100644 --- a/core/src/main/java/google/registry/flows/domain/token/AllocationTokenFlowUtils.java +++ b/core/src/main/java/google/registry/flows/domain/token/AllocationTokenFlowUtils.java @@ -69,9 +69,8 @@ public class AllocationTokenFlowUtils { try { tokenEntity = loadToken(token); } catch (EppException e) { - return AllocationTokenDomainCheckResults.create( - Optional.empty(), - ImmutableMap.copyOf(Maps.toMap(domainNames, ignored -> e.getMessage()))); + return new AllocationTokenDomainCheckResults( + Optional.empty(), Maps.toMap(domainNames, ignored -> e.getMessage())); } // If the token is only invalid for some domain names (e.g. an invalid TLD), include those error @@ -97,8 +96,7 @@ public class AllocationTokenFlowUtils { resultsBuilder.putAll( tokenCustomLogic.checkDomainsWithToken( validDomainNames.build(), tokenEntity, registrarId, now)); - return AllocationTokenDomainCheckResults.create( - Optional.of(tokenEntity), resultsBuilder.build()); + return new AllocationTokenDomainCheckResults(Optional.of(tokenEntity), resultsBuilder.build()); } /** Redeems a SINGLE_USE {@link AllocationToken}, returning the redeemed copy. */ diff --git a/core/src/main/java/google/registry/model/ForeignKeyUtils.java b/core/src/main/java/google/registry/model/ForeignKeyUtils.java index ab2f7f614..93408c352 100644 --- a/core/src/main/java/google/registry/model/ForeignKeyUtils.java +++ b/core/src/main/java/google/registry/model/ForeignKeyUtils.java @@ -23,7 +23,6 @@ import static google.registry.persistence.transaction.TransactionManagerFactory. import com.github.benmanes.caffeine.cache.CacheLoader; import com.github.benmanes.caffeine.cache.LoadingCache; -import com.google.auto.value.AutoValue; import com.google.common.annotations.VisibleForTesting; import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; @@ -221,15 +220,10 @@ public final class ForeignKeyUtils { e -> VKey.create(clazz, e.getValue().get().repoId()))); } - @AutoValue - abstract static class MostRecentResource { - - abstract String repoId(); - - abstract DateTime deletionTime(); + record MostRecentResource(String repoId, DateTime deletionTime) { static MostRecentResource create(String repoId, DateTime deletionTime) { - return new AutoValue_ForeignKeyUtils_MostRecentResource(repoId, deletionTime); + return new MostRecentResource(repoId, deletionTime); } } }