Class AttributeDifference<T>

  • Type Parameters:
    T - the type of the value which has a difference
    All Implemented Interfaces:
    java.io.Serializable, java.lang.Comparable<AttributeDifference<?>>

    @JsonData
    public abstract class AttributeDifference<T>
    extends java.lang.Object
    implements java.lang.Comparable<AttributeDifference<?>>, java.io.Serializable
    Basic class for difference descriptions
    Since:
    3.0
    See Also:
    Serialized Form
    • Constructor Detail

      • AttributeDifference

        public AttributeDifference​(AttributeDifference.TYPE instanceType,
                                   T oldValue,
                                   T newValue,
                                   java.lang.String messageKey)
        Creates an instance with an old and a new value and sets the instanceType and the messageKey
        Parameters:
        instanceType - the instance type
        oldValue - the old value
        newValue - the new value
        messageKey - the message key
        Since:
        3.0
    • Method Detail

      • getMessage

        public java.lang.String getMessage()
        Returns the log message for this difference
        Returns:
        the log message for this difference, never null
        Since:
        3.0
      • equals

        public boolean equals​(java.lang.Object obj)
        Overrides:
        equals in class java.lang.Object
      • compareTo

        public int compareTo​(AttributeDifference<?> o)
        Specified by:
        compareTo in interface java.lang.Comparable<T>
      • getOldValue

        public T getOldValue()
        Returns the value of the compared property in the first document
        Returns:
        the value of the compared property in the first document
        Since:
        3.0
      • getNewValue

        public T getNewValue()
        Returns the value of the compared property in the second document
        Returns:
        the value of the compared property in the second document
        Since:
        3.0
      • getInstanceType

        public AttributeDifference.TYPE getInstanceType()
        Returns the type of this instance. This type is the only information about the actual type of the difference if the model was JSON serialized
        Returns:
        the instanceType, not null
        Since:
        4.0
      • getOldValueDescriptor

        public java.lang.String getOldValueDescriptor()
        Returns the descriptor for the old value, which is the formatted old value object
        Returns:
        the descriptor for the old value
        Since:
        4.0
      • getNewValueDescriptor

        public java.lang.String getNewValueDescriptor()
        Returns the descriptor for the new value, which is the formatted new value object
        Returns:
        the descriptor for the new value
        Since:
        4.0