Class ImmutableObject

java.lang.Object
google.registry.model.ImmutableObject
All Implemented Interfaces:
Cloneable
Direct Known Subclasses:
Address, AllocationTokenExtension, AuthInfo, AuthInfo.PasswordAuth, BaseDomainLabelList, BaseFee, BaseTransferObject, BillingBase, BulkPricingPackage, BulkTokenExtension, BulkTokenResponseExtension, CheckData, CheckData.Check, CheckData.CheckNameOrID, ClaimsList, CommonMarkContactFields, CommonMarkFields, ConsoleUpdateHistory, ContactCommand.ContactCreateOrChange, CreateAutoTimestamp, CrossTldSingleton, Cursor.CursorId, DesignatedContact, Disclose, Disclose.PostalInfoChoice, DnsRefreshRequest, DomainCommand.DomainCreateOrChange, DomainCommand.Info, DomainCommand.Info.NameWithHosts, DomainDsDataBase, DomainLabelEntry, DomainObjectSpec, DomainTransactionRecord, EncodedSignedMark, EppInput, EppInput.CommandWrapper, EppInput.InnerCommand, EppInput.Options, EppInput.Services, EppOutput, EppResponse, FeatureFlag, FeeCheckCommandExtensionV06, FeeCheckCommandExtensionV11, FeeCheckCommandExtensionV12, FeeCheckResponseExtensionItemCommandV12, FeeCheckResponseExtensionV06, FeeCheckResponseExtensionV11, FeeCheckResponseExtensionV12, FeeExtensionCommandDescriptor, FeeQueryCommandExtensionItem, FeeQueryResponseExtensionItem, FeesAndCredits, FeeTransformCommandExtension, FeeTransformResponseExtension, ForeignKeyedDesignatedContact, GracePeriodBase, Greeting, HistoryEntry, HistoryEntry.HistoryEntryId, IssuerInfo, LaunchCheckExtension, LaunchCheckResponseExtension, LaunchCheckResponseExtension.LaunchCheck, LaunchCheckResponseExtension.LaunchCheckName, LaunchExtension, LaunchNotice, LaunchNotice.NoticeIdType, LaunchPhase, Lock, Mark, MarkProtection, MessageQueueInfo, MetadataExtension, PendingActionNotificationResponse, Period, PhoneNumber, PollMessage, PostalInfo, PresenceMarker, RdeRevision.RdeRevisionId, RegistrarPoc.RegistrarPocId, RegistrarPocBase, ResourceCommand.AbstractSingleResourceCommand, ResourceCommand.ResourceCheck, ResourceCommand.ResourceUpdate.AddRemove, Result, RgpInfoExtension, RgpUpdateExtension, SecDnsCreateExtension, SecDnsInfoExtension, SecDnsUpdateExtension, SecDnsUpdateExtension.Add, SecDnsUpdateExtension.Change, SecDnsUpdateExtension.Remove, SignedMark, SignedMarkRevocationList, Spec11ThreatMatch, SuperuserExtension, TimeOfYear, Tld, Trid, UpdateAutoTimestamp, UpdateAutoTimestampEntity, UserRoles, VKey

@Immutable public abstract class ImmutableObject extends Object implements Cloneable
An immutable object that implements equals(java.lang.Object), hashCode and toString().
  • Field Details

    • hashCode

      protected Integer hashCode
  • Constructor Details

    • ImmutableObject

      public ImmutableObject()
  • Method Details

    • getSignificantFields

      protected Map<Field,Object> getSignificantFields()
      Returns the map of significant fields (fields that we care about for purposes of comparison and display).

      Isolated into a method so that derived classes can override it.

    • equals

      public boolean equals(Object other)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • clone

      protected static <T extends ImmutableObject> T clone(T t)
      Returns a clone of the given object.
    • cloneEmptyToNull

      protected static <T extends ImmutableObject> T cloneEmptyToNull(T t)
      Returns a clone of the given object with empty fields set to null.
    • toString

      public String toString()
      Returns a string view of the object, formatted like:
       ModelObject (@12345): {
         field1=value1
         field2=[a,b,c]
         field3=AnotherModelObject: {
           foo=bar
         }
       }
       
      Overrides:
      toString in class Object
    • toHydratedString

      public String toHydratedString()
      Similar to toString(), with a full expansion of referenced keys, including in collections.
    • toStringHelper

      public String toStringHelper(SortedMap<String,Object> fields)
    • toDiffableFieldMap

      public Map<String,Object> toDiffableFieldMap()
      Returns a map of all object fields (including sensitive data) that's used to produce diffs.
    • createVKey

      public VKey<? extends ImmutableObject> createVKey()