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 Object implements org.apache.jackrabbit.oak.cache.CacheValue
A revision.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Revision
asBranchRevision()
Returns a revision with the same timestamp, counter and clusterId as this revision and the branch flag set totrue
.Revision
asTrunkRevision()
Returns a revision with the same timestamp, counter and clusterId as this revision and the branch flag set tofalse
.boolean
equals(Object other)
static Revision
fromString(String rev)
int
getClusterId()
int
getCounter()
static long
getCurrentTimestamp()
Get the timestamp value of the current date and time.int
getMemory()
long
getTimestamp()
Get the timestamp in milliseconds since 1970.static long
getTimestampDifference(Revision r1, Revision r2)
Get the timestamp difference between two revisions (r1 - r2) in milliseconds.int
hashCode()
boolean
isBranch()
String
toReadableString()
String
toString()
StringBuilder
toStringBuilder(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
-
toStringBuilder
public StringBuilder toStringBuilder(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 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:
true
if 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.
-
getClusterId
public int getClusterId()
-
getMemory
public int getMemory()
- Specified by:
getMemory
in interfaceorg.apache.jackrabbit.oak.cache.CacheValue
-
-