Class ImmutableObject

    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected java.lang.Integer hashCode  
    • Constructor Summary

      Constructors 
      Constructor Description
      ImmutableObject()  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected static <T extends ImmutableObject>
      T
      clone​(T t)
      Returns a clone of the given object.
      protected static <T extends ImmutableObject>
      T
      cloneEmptyToNull​(T t)
      Returns a clone of the given object with empty fields set to null.
      VKey<? extends ImmutableObject> createVKey()  
      boolean equals​(java.lang.Object other)  
      protected java.util.Map<java.lang.reflect.Field,​java.lang.Object> getSignificantFields()
      Returns the map of significant fields (fields that we care about for purposes of comparison and display).
      int hashCode()  
      java.util.Map<java.lang.String,​java.lang.Object> toDiffableFieldMap()
      Returns a map of all object fields (including sensitive data) that's used to produce diffs.
      java.lang.String toHydratedString()
      Similar to toString(), with a full expansion of referenced keys, including in collections.
      java.lang.String toString()
      Returns a string view of the object, formatted like:
      java.lang.String toStringHelper​(java.util.SortedMap<java.lang.String,​java.lang.Object> fields)  
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, wait, wait, wait
    • Field Detail

      • hashCode

        protected java.lang.Integer hashCode
    • Constructor Detail

      • ImmutableObject

        public ImmutableObject()
    • Method Detail

      • getSignificantFields

        protected java.util.Map<java.lang.reflect.Field,​java.lang.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​(java.lang.Object other)
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.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 java.lang.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 java.lang.Object
      • toHydratedString

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

        public java.lang.String toStringHelper​(java.util.SortedMap<java.lang.String,​java.lang.Object> fields)
      • toDiffableFieldMap

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