Package org.springframework.data.history
Class AnnotationRevisionMetadata<N extends Number & Comparable<N>>
java.lang.Object
org.springframework.data.history.AnnotationRevisionMetadata<N>
- All Implemented Interfaces:
RevisionMetadata<N>
public class AnnotationRevisionMetadata<N extends Number & Comparable<N>>
extends Object
implements RevisionMetadata<N>
A
RevisionMetadata implementation that inspects the given object for fields with the configured annotations
and returns the field's values on calls to getRevisionInstant(), getRevisionInstant() and
getRevisionNumber().- Author:
- Oliver Gierke, Jens Schauder, Mark Paluch, Johannes Englmeier
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.springframework.data.history.RevisionMetadata
RevisionMetadata.RevisionType -
Constructor Summary
ConstructorsConstructorDescriptionAnnotationRevisionMetadata(Object entity, Class<? extends Annotation> revisionNumberAnnotation, Class<? extends Annotation> revisionTimeStampAnnotation) Creates a newAnnotationRevisionMetadatainspecting the given entity for the given annotations.AnnotationRevisionMetadata(Object entity, Class<? extends Annotation> revisionNumberAnnotation, Class<? extends Annotation> revisionTimeStampAnnotation, RevisionMetadata.RevisionType revisionType) Creates a newAnnotationRevisionMetadatainspecting the given entity for the given annotations. -
Method Summary
Modifier and TypeMethodDescription<T> TReturns the underlying revision metadata which might provider more detailed implementation specific information.Returns the timestamp of the revision.Returns the revision number of the revision.Returns theRevisionMetadata.RevisionTypeof this change.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.springframework.data.history.RevisionMetadata
getRequiredRevisionInstant, getRequiredRevisionNumber
-
Constructor Details
-
AnnotationRevisionMetadata
public AnnotationRevisionMetadata(Object entity, Class<? extends Annotation> revisionNumberAnnotation, Class<? extends Annotation> revisionTimeStampAnnotation) Creates a newAnnotationRevisionMetadatainspecting the given entity for the given annotations. If no annotations will be provided these values will not be looked up from the entity and return null. The revisionType will be set to unknown- Parameters:
entity- must not be null.revisionNumberAnnotation- must not be null.revisionTimeStampAnnotation- must not be null.
-
AnnotationRevisionMetadata
public AnnotationRevisionMetadata(Object entity, Class<? extends Annotation> revisionNumberAnnotation, Class<? extends Annotation> revisionTimeStampAnnotation, RevisionMetadata.RevisionType revisionType) Creates a newAnnotationRevisionMetadatainspecting the given entity for the given annotations. If no annotations will be provided these values will not be looked up from the entity and return null.- Parameters:
entity- must not be null.revisionNumberAnnotation- must not be null.revisionTimeStampAnnotation- must not be null.revisionType- must not be null.- Since:
- 2.2.0
-
-
Method Details
-
getRevisionNumber
Description copied from interface:RevisionMetadataReturns the revision number of the revision.- Specified by:
getRevisionNumberin interfaceRevisionMetadata<N extends Number & Comparable<N>>- Returns:
- will never be null.
-
getRevisionInstant
Description copied from interface:RevisionMetadataReturns the timestamp of the revision.- Specified by:
getRevisionInstantin interfaceRevisionMetadata<N extends Number & Comparable<N>>- Returns:
- will never be null.
-
getRevisionType
Description copied from interface:RevisionMetadataReturns theRevisionMetadata.RevisionTypeof this change. If theRevisionMetadata.RevisionTypecannot be determined, this method returnsRevisionMetadata.RevisionType.UNKNOWN.- Specified by:
getRevisionTypein interfaceRevisionMetadata<N extends Number & Comparable<N>>- Returns:
- will never be null.
-
getDelegate
public <T> T getDelegate()Description copied from interface:RevisionMetadataReturns the underlying revision metadata which might provider more detailed implementation specific information.- Specified by:
getDelegatein interfaceRevisionMetadata<N extends Number & Comparable<N>>- Returns:
-