public class SVNRevision
extends java.lang.Object
Most of high-level API classes' methods receive revision parameters as SVNRevision objects to get information on SVN revisions and use it in version control operations.
This class provides advantages of specifying revisions either as just long numbers or dated revisions (when a revision is determined according to a particular timestamp) or SVN compatible keywords denoting the latest revision (HEAD), Working Copy pristine revision (BASE) and so on. And one more feature is that SVNRevision can parse strings (that can be anything: string representations of numbers, dates, keywords) to construct an SVNRevision to use.
Modifier and Type | Field and Description |
---|---|
static SVNRevision |
BASE
Denotes the 'pristine' revision of a Working Copy item.
|
static SVNRevision |
COMMITTED
Denotes the last revision in which an item was changed before (or
at) BASE.
|
static SVNRevision |
HEAD
Denotes the latest repository revision.
|
static SVNRevision |
PREVIOUS
Denotes the revision just before the one when an item was last
changed (technically, COMMITTED - 1).
|
static SVNRevision |
UNDEFINED
Used to denote that a revision is undefined (not available or not
valid).
|
static SVNRevision |
WORKING
Denotes an item's working (current) revision.
|
Modifier and Type | Method and Description |
---|---|
static SVNRevision |
create(java.util.Date date)
Creates an SVNRevision object given a particular timestamp.
|
static SVNRevision |
create(long revisionNumber)
Creates an SVNRevision object given a revision number.
|
boolean |
equals(java.lang.Object o)
Compares this object with another SVNRevision object.
|
java.util.Date |
getDate()
Gets the timestamp used to specify a revision.
|
int |
getID()
Gets the identifier of the revision information kind this
object represents.
|
java.lang.String |
getName()
Gets the revision keyword name.
|
long |
getNumber()
Gets the revision number represented by this object.
|
int |
hashCode()
Evaluates the hash code for this object.
|
boolean |
isLocal()
|
boolean |
isValid()
Checks if the revision information represented by this object
is valid.
|
static boolean |
isValidRevisionNumber(long revision)
Checks whether a revision number is valid.
|
static SVNRevision |
parse(java.lang.String value)
Parses an input string and be it a representation of either
a revision number, or a timestamp, or a revision keyword, constructs
an SVNRevision representation of the revision.
|
java.lang.String |
toString()
Gives a string representation of this object.
|
public static final SVNRevision HEAD
public static final SVNRevision WORKING
public static final SVNRevision PREVIOUS
public static final SVNRevision BASE
public static final SVNRevision COMMITTED
public static final SVNRevision UNDEFINED
public java.lang.String getName()
public long getNumber()
public java.util.Date getDate()
public boolean isValid()
UNDEFINED
is not a valid revision.
public int getID()
public int hashCode()
hash code = (int) revisionNumber & 0xFFFFFFFF
;
Date.hashCode()
is used;
String.hashCode()
is used for the keyword name;
hashCode
in class java.lang.Object
public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
o
- an object to be compared with; if it's not an
SVNRevision then this method certainly returns
falsepublic static boolean isValidRevisionNumber(long revision)
revision
- a revision number>=0
),
otherwise falsepublic static SVNRevision create(long revisionNumber)
revisionNumber
- a definite revision numberpublic static SVNRevision create(java.util.Date date)
date
- a timestamp represented as a Date instancepublic boolean isLocal()
BASE
or WORKING
.public static SVNRevision parse(java.lang.String value)
value
- a string to be parsedvalue
; however
if an input string is not a valid one which can be
successfully transformed to an SVNRevision the
return value is UNDEFINED
public java.lang.String toString()
toString
in class java.lang.Object
Copyright © 2004-2012 TMate Software Ltd. All Rights Reserved.