Package org.springframework.data.history
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 Summary
Modifier and TypeMethodDescriptionint
boolean
Returns the timestamp of the revision, immediately failing on absence.Returns the revision number of the revision, immediately failing on absence.Returns the timestamp of the revision.Returns the revision number of the revision.int
hashCode()
static <N extends Number & Comparable<N>,
T>
Revision<N,T> of
(RevisionMetadata<N> metadata, T entity) Creates a newRevision
for the givenRevisionMetadata
and entity.toString()
-
Method Details
-
of
public static <N extends Number & Comparable<N>,T> Revision<N,T> of(RevisionMetadata<N> metadata, T entity) Creates a newRevision
for the givenRevisionMetadata
and entity.- Parameters:
metadata
- must not be null.entity
- must not be null.- Returns:
-
getRevisionNumber
Returns the revision number of the revision.- Returns:
- the revision number.
-
getRequiredRevisionNumber
Returns the revision number of the revision, immediately failing on absence.- Returns:
- the revision number.
-
getRevisionInstant
Returns the timestamp of the revision.- Returns:
- Guaranteed to be not null.
-
getRequiredRevisionInstant
Returns the timestamp of the revision, immediately failing on absence.- Returns:
- the revision
Instant
. May be null.
-
compareTo
- Specified by:
compareTo
in interfaceComparable<N extends Number & Comparable<N>>
-
toString
-
getMetadata
-
getEntity
-
equals
-
hashCode
public int hashCode()
-