Class Revision<N extends Number & Comparable<N>,T>

java.lang.Object
org.springframework.data.history.Revision<N,T>
All Implemented Interfaces:
Comparable<Revision<N,?>>

public final class Revision<N extends Number & Comparable<N>,T> extends Object implements Comparable<Revision<N,?>>
Wrapper to contain RevisionMetadata as well as the revisioned entity.
Author:
Oliver Gierke, Philipp Huegelmeyer, Christoph Strobl, Jens Schauder
  • Method Details

    • of

      public static <N extends Number & Comparable<N>, T> Revision<N,T> of(RevisionMetadata<N> metadata, T entity)
      Creates a new Revision for the given RevisionMetadata and entity.
      Parameters:
      metadata - must not be null.
      entity - must not be null.
      Returns:
    • getRevisionNumber

      public Optional<N> getRevisionNumber()
      Returns the revision number of the revision.
      Returns:
      the revision number.
    • getRequiredRevisionNumber

      public N getRequiredRevisionNumber()
      Returns the revision number of the revision, immediately failing on absence.
      Returns:
      the revision number.
    • getRevisionInstant

      public Optional<Instant> getRevisionInstant()
      Returns the timestamp of the revision.
      Returns:
      Guaranteed to be not null.
    • getRequiredRevisionInstant

      public Instant getRequiredRevisionInstant()
      Returns the timestamp of the revision, immediately failing on absence.
      Returns:
      the revision Instant. May be null.
    • compareTo

      public int compareTo(@Nullable Revision<N,?> that)
      Specified by:
      compareTo in interface Comparable<N extends Number & Comparable<N>>
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • getMetadata

      public RevisionMetadata<N> getMetadata()
    • getEntity

      public T getEntity()
    • equals

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

      public int hashCode()
      Overrides:
      hashCode in class Object