Class Revision
- java.lang.Object
-
- org.apache.jackrabbit.oak.plugins.document.Revision
-
- All Implemented Interfaces:
org.apache.jackrabbit.oak.cache.CacheValue
public final class Revision extends java.lang.Object implements org.apache.jackrabbit.oak.cache.CacheValueA revision.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description RevisionasBranchRevision()Returns a revision with the same timestamp, counter and clusterId as this revision and the branch flag set totrue.RevisionasTrunkRevision()Returns a revision with the same timestamp, counter and clusterId as this revision and the branch flag set tofalse.booleanequals(java.lang.Object other)static RevisionfromString(java.lang.String rev)intgetClusterId()intgetCounter()static longgetCurrentTimestamp()Get the timestamp value of the current date and time.intgetMemory()longgetTimestamp()Get the timestamp in milliseconds since 1970.static longgetTimestampDifference(Revision r1, Revision r2)Get the timestamp difference between two revisions (r1 - r2) in milliseconds.inthashCode()booleanisBranch()java.lang.StringtoReadableString()java.lang.StringtoString()java.lang.StringBuildertoStringBuilder(java.lang.StringBuilder sb)Appends the string representation of this revision to the given StringBuilder.
-
-
-
Method Detail
-
getCurrentTimestamp
public static long getCurrentTimestamp()
Get the timestamp value of the current date and time. Within the same process, the returned value is never smaller than a previously returned value, even if the system time was changed.- Returns:
- the timestamp
-
getTimestampDifference
public static long getTimestampDifference(Revision r1, Revision r2)
Get the timestamp difference between two revisions (r1 - r2) in milliseconds.- Parameters:
r1- the first revisionr2- the second revision- Returns:
- the difference in milliseconds
-
fromString
public static Revision fromString(java.lang.String rev)
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
toStringBuilder
public java.lang.StringBuilder toStringBuilder(java.lang.StringBuilder sb)
Appends the string representation of this revision to the given StringBuilder.- Parameters:
sb- a StringBuilder.- Returns:
- the StringBuilder instance passed to this method.
-
toReadableString
public java.lang.String toReadableString()
-
getTimestamp
public long getTimestamp()
Get the timestamp in milliseconds since 1970.- Returns:
- the timestamp
-
getCounter
public int getCounter()
-
isBranch
public boolean isBranch()
- Returns:
trueif this is a branch revision, otherwisefalse.
-
asBranchRevision
public Revision asBranchRevision()
Returns a revision with the same timestamp, counter and clusterId as this revision and the branch flag set totrue.- Returns:
- branch revision with this timestamp, counter and clusterId.
-
asTrunkRevision
public Revision asTrunkRevision()
Returns a revision with the same timestamp, counter and clusterId as this revision and the branch flag set tofalse.- Returns:
- trunk revision with this timestamp, counter and clusterId.
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
equals
public boolean equals(java.lang.Object other)
- Overrides:
equalsin classjava.lang.Object
-
getClusterId
public int getClusterId()
-
getMemory
public int getMemory()
- Specified by:
getMemoryin interfaceorg.apache.jackrabbit.oak.cache.CacheValue
-
-