#116 - Implemented RevisionMetadata.getRevisionInstant().

Implemented the missing new method RevisionMetadata.getRevisionInstant() by extracting part of ….getRevisionDate(). This makes DefaultRevisionMetadata compile again.

Decided against a default implementation on the interface side since it would just hide the fact that the interface changed.

Original pull request: #118.
This commit is contained in:
Jens Schauder
2018-02-19 11:13:37 +01:00
committed by Oliver Gierke
parent 67c14d8883
commit 14e4386205

View File

@@ -52,8 +52,19 @@ public class DefaultRevisionMetadata implements RevisionMetadata<Integer> {
* (non-Javadoc)
* @see org.springframework.data.history.RevisionMetadata#getRevisionDate()
*/
@Deprecated
public Optional<LocalDateTime> getRevisionDate() {
return Optional.of(LocalDateTime.ofInstant(Instant.ofEpochMilli(entity.getTimestamp()), ZoneOffset.systemDefault()));
return getRevisionInstant().map(instant -> LocalDateTime.ofInstant(instant, ZoneOffset.systemDefault()));
}
/*
* (non-Javadoc)
* @see org.springframework.data.history.RevisionMetadata#getRevisionInstant()
*/
@Override
public Optional<Instant> getRevisionInstant() {
return Optional.of(Instant.ofEpochMilli(entity.getTimestamp()));
}
/*