public class PathAnnotations
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
protected int |
changelistId |
protected java.util.Date |
date |
protected int |
endRevision |
protected java.lang.String |
label |
static java.lang.String |
NONREV_PFX
The string used to start Perforce file label / changelist / date metadata
annotations.
|
static java.lang.String |
REV_PFX
The string used to start Perforce file revision metadata annotations.
|
static java.lang.String |
REV_SEP
The string used to separate Perforce file revision metadata annotations.
|
protected int |
startRevision |
Constructor and Description |
---|
PathAnnotations()
Construct a PathAnnotations object with default field values:
startRev, endRev = IFileSpec.NO_FILE_REVISION; date, label = null; changelist = IChangelist.UNKNOWN. |
PathAnnotations(IFileSpec fileSpec)
Construct a PathAnnotations object for a specific file spec.
|
PathAnnotations(int startRevision,
int endRevision,
java.util.Date date,
int changelistId,
java.lang.String label)
Construct a PathAnnotations object from explicit candidate field values.
|
PathAnnotations(java.lang.String pathStr)
Construct a PathAnnotations object from the passed-in string,
which is assumed to contain a path string with optional
Perforce annotations.
|
Modifier and Type | Method and Description |
---|---|
static boolean |
extractNonRevisionData(java.lang.String pathStr,
PathAnnotations pathAnnotations)
Extract any non-revision info from the passed-in pathStr and put it into
the passed-in pathAnnotations object.
|
static boolean |
extractRevisionData(java.lang.String pathStr,
PathAnnotations pathAnnotations)
Extract any start / end revision info from the passed-in pathStr and put it into
the passed-in pathAnnotations object.
|
static PathAnnotations |
getAnnotations(java.lang.String pathStr)
Get all Perforce metadata annotations from the passed-in string.
|
int |
getChangelistId() |
java.util.Date |
getDate() |
int |
getEndRevision() |
java.lang.String |
getLabel() |
int |
getStartRevision() |
static int |
hasNonRevisionAnnotations(java.lang.String pathStr)
Return non-negative index of first non-revision Perforce annotations match in the
string if the passed-in string is not null and has label, changelist, date,
etc., specs appended.
|
static boolean |
hasPerforceAnnotations(java.lang.String pathStr)
Return true if the passed-in path is not null and has Perforce file
metadata appended to it.
|
static int |
hasRevisionAnnotations(java.lang.String pathStr)
Return non-negative index of first non-revision Perforce annotations match in the
string if the passed-in string is not null has Perforce
revision annotations appended to it.
|
void |
setChangelistId(int changelistId) |
void |
setDate(java.util.Date date) |
void |
setEndRevision(int endRev) |
void |
setLabel(java.lang.String label) |
void |
setStartRevision(int startRev) |
static java.lang.String |
stripAnnotations(java.lang.String pathStr)
Strip any Perforce file metadata annotations from the passed-in string.
|
java.lang.String |
toString()
Return a Perforce-standard string representation of this
annotation.
|
public static final java.lang.String REV_PFX
public static final java.lang.String REV_SEP
public static final java.lang.String NONREV_PFX
protected int startRevision
protected int endRevision
protected java.util.Date date
protected int changelistId
protected java.lang.String label
public PathAnnotations()
public PathAnnotations(int startRevision, int endRevision, java.util.Date date, int changelistId, java.lang.String label)
startRevision
- startRevisionendRevision
- endRevisiondate
- datechangelistId
- changelistIdlabel
- labelpublic PathAnnotations(IFileSpec fileSpec)
fileSpec
- fileSpecpublic PathAnnotations(java.lang.String pathStr)
pathStr
- pathStrpublic static java.lang.String stripAnnotations(java.lang.String pathStr)
pathStr
- pathStrpublic static PathAnnotations getAnnotations(java.lang.String pathStr)
pathStr
- pathStrpublic static int hasRevisionAnnotations(java.lang.String pathStr)
pathStr
- pathStrpublic static int hasNonRevisionAnnotations(java.lang.String pathStr)
pathStr
- pathStrpublic static boolean hasPerforceAnnotations(java.lang.String pathStr)
pathStr
- pathStrpublic static boolean extractRevisionData(java.lang.String pathStr, PathAnnotations pathAnnotations)
If either or both pathStr and pathAnnotations is null, returns false.
pathStr
- pathStrpathAnnotations
- pathAnnotationspublic static boolean extractNonRevisionData(java.lang.String pathStr, PathAnnotations pathAnnotations)
Note that the candidate string "@2009/09/12" is ambiguous -- it could be either a date or a label by a generous reading of the Perforce specs -- but we take the "if it looks like a duck..." approach here and parse it as a date if at all possible. Similarly for the string "@12345" which could be a changelist ID or a label ID -- we parse it as a changelist ID if at all possible.
If either or both pathStr and pathAnnotations is null, returns false.
pathStr
- pathStrpathAnnotations
- pathAnnotationspublic java.lang.String toString()
toString
in class java.lang.Object
public int getStartRevision()
public void setStartRevision(int startRev)
public int getEndRevision()
public void setEndRevision(int endRev)
public java.util.Date getDate()
public void setDate(java.util.Date date)
public int getChangelistId()
public void setChangelistId(int changelistId)
public java.lang.String getLabel()
public void setLabel(java.lang.String label)