Spring Data Core

org.springframework.data.history
Class AnnotationRevisionMetadata<N extends Number & Comparable<N>>

java.lang.Object
  extended by 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 getRevisionDate() and getRevisionNumber().

Author:
Oliver Gierke

Constructor Summary
AnnotationRevisionMetadata(Object entity, Class<? extends Annotation> revisionNumberAnnotation, Class<? extends Annotation> revisionTimeStampAnnotation)
          Creates a new AnnotationRevisionMetadata inspecing the given entity for the given annotations.
 
Method Summary
<T> T
getDelegate()
          Returns the underlying revision metadata which might provider more detailed implementation specific information.
 org.joda.time.DateTime getRevisionDate()
          Returns the date of the revision.
 N getRevisionNumber()
          Returns the revision number of the revision.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AnnotationRevisionMetadata

public AnnotationRevisionMetadata(Object entity,
                                  Class<? extends Annotation> revisionNumberAnnotation,
                                  Class<? extends Annotation> revisionTimeStampAnnotation)
Creates a new AnnotationRevisionMetadata inspecing 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 -
revisionTimeStampAnnotation -
Method Detail

getRevisionNumber

public N getRevisionNumber()
Description copied from interface: RevisionMetadata
Returns the revision number of the revision.

Specified by:
getRevisionNumber in interface RevisionMetadata<N extends Number & Comparable<N>>
Returns:

getRevisionDate

public org.joda.time.DateTime getRevisionDate()
Description copied from interface: RevisionMetadata
Returns the date of the revision.

Specified by:
getRevisionDate in interface RevisionMetadata<N extends Number & Comparable<N>>
Returns:

getDelegate

public <T> T getDelegate()
Description copied from interface: RevisionMetadata
Returns the underlying revision metadata which might provider more detailed implementation specific information.

Specified by:
getDelegate in interface RevisionMetadata<N extends Number & Comparable<N>>
Returns:

Spring Data Core

Copyright © 2011-2013-2013 Pivotal. All Rights Reserved.