public class CommitDescriptor extends java.lang.Object implements java.io.Serializable, java.lang.Comparable<CommitDescriptor>
org.conqat.engine.service.shared.client.IdeServiceClient
), so special
care has to be taken when changing its signature!Modifier and Type | Field and Description |
---|---|
static java.util.Comparator<CommitDescriptor> |
BY_TIMESTAMP_COMPARATOR
A comparator for comparison by timestamps.
|
static java.lang.String |
HEAD_TIMESTAMP
Special value to indicate the HEAD of a branch.
|
static byte[] |
SEPARATOR
The separator used between branch name and timestamp in
toBranchTimestampKeyWithSeparator() . |
Constructor and Description |
---|
CommitDescriptor(CommitDescriptor other) |
CommitDescriptor(java.lang.String branchName,
long timestamp)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
CommitDescriptor |
cloneWithDecrementedTimestamp()
Create a copy of this commit descriptor with
timestamp - 1 . |
CommitDescriptor |
cloneWithIncrementedTimestamp()
Create a copy of this commit descriptor with
timestamp + 1 . |
int |
compareTo(CommitDescriptor other) |
static CommitDescriptor |
createUnbranchedDescriptor(long timestamp)
Create a
CommitDescriptor without branch specification. |
boolean |
equals(java.lang.Object obj) |
static CommitDescriptor |
fromBranchTimestampKey(byte[] key)
Parses a branchN+timestamp key/byte[] representation.
|
static CommitDescriptor |
fromJson(java.lang.String json)
Reads a
CommitDescriptor from a JSON string. |
static CommitDescriptor |
fromStringRepresentation(java.lang.String representation)
Parses a commit descriptor from its toString() representation.
|
static CommitDescriptor |
fromTimestampBranchKey(byte[] key)
Parses a timestamp+branchName key/byte[] representation.
|
java.lang.String |
getBranchName() |
long |
getTimestamp() |
int |
hashCode() |
boolean |
isHeadCommit()
Returns whether this commit is a head timestamp
|
boolean |
isUnbranched()
Return true if no branch is specified.
|
static CommitDescriptor |
latestOnBranch(java.lang.String branchName)
Creates a commit descriptor for the latest revision on a branch
|
byte[] |
toBranchTimestampKey()
Returns a branchName+timestamp key/byte[] representation.
|
byte[] |
toBranchTimestampKeyWithSeparator()
Returns a branchName+timestamp key/byte[] representation with
SEPARATOR in between. |
java.lang.String |
toEncodedPathParam()
Returns a url-encoded format used for service calls ("branch:timestamp", or
"timestamp" if no branch is specified).
|
java.lang.String |
toEncodedQueryParam()
Returns a url-encoded format used for service calls ("branch:timestamp", or
"timestamp" if no branch is specified).
|
java.lang.String |
toJson()
Converts this to a JSON representation.
|
java.lang.String |
toServiceCallFormat()
Returns a format used for service calls ("branch:timestamp", or "timestamp"
if no branch is specified).
|
java.lang.String |
toString() |
byte[] |
toTimestampBranchKey()
Returns a timestamp+branchName key/byte[] representation.
|
public static final byte[] SEPARATOR
toBranchTimestampKeyWithSeparator()
.public static final java.lang.String HEAD_TIMESTAMP
public static final java.util.Comparator<CommitDescriptor> BY_TIMESTAMP_COMPARATOR
public CommitDescriptor(java.lang.String branchName, long timestamp)
createUnbranchedDescriptor(long)
to create a
unbranched commit descriptor.public CommitDescriptor(CommitDescriptor other)
public static CommitDescriptor createUnbranchedDescriptor(long timestamp)
CommitDescriptor
without branch specification. public CommitDescriptor cloneWithDecrementedTimestamp()
timestamp - 1
.
Using this CommitDescriptor to store a new commit might overwrite an existing
commit if the timestamp is already used.public CommitDescriptor cloneWithIncrementedTimestamp()
timestamp + 1
.
Using this CommitDescriptor to store a new commit might overwrite an existing
commit if the timestamp is already used.public java.lang.String getBranchName()
branchName
public boolean isUnbranched()
public boolean isHeadCommit()
public long getTimestamp()
timestamp
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public int compareTo(CommitDescriptor other)
compareTo
in interface java.lang.Comparable<CommitDescriptor>
public java.lang.String toJson()
public static CommitDescriptor fromJson(java.lang.String json) throws ConQATException
CommitDescriptor
from a JSON string.ConQATException
public java.lang.String toString()
toString
in class java.lang.Object
public byte[] toTimestampBranchKey()
public static CommitDescriptor fromStringRepresentation(java.lang.String representation)
public static CommitDescriptor fromTimestampBranchKey(byte[] key)
public byte[] toBranchTimestampKey()
toBranchTimestampKeyWithSeparator()
.public byte[] toBranchTimestampKeyWithSeparator()
SEPARATOR
in between.public static CommitDescriptor fromBranchTimestampKey(byte[] key)
public static CommitDescriptor latestOnBranch(java.lang.String branchName)
public java.lang.String toServiceCallFormat()
toEncodedPathParam()
,
toEncodedQueryParam()
public java.lang.String toEncodedQueryParam()
public java.lang.String toEncodedPathParam()