|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
ObjectVersion
public class Version
Holds a version number. Versions are often of the form major.minor.revision
, but
are not required to. For example an EPSG database version is "6.11.2"
. The
separator character is the dot.
This class provides convenience methods for fetching the major, minor and reversion numbers, and for performing comparaisons.
GeoTools.getVersion()
,
Serialized Form
modules/library/metadata (gt-metadata.jar)
Field Summary | |
---|---|
static char |
SEPARATOR
The separator character between major, minor and revision components. |
Constructor Summary | |
---|---|
Version(String version)
Creates a new version object from the supplied string. |
Method Summary | |
---|---|
char |
charAt(int index)
Returns the char value at the specified index. |
int |
compareTo(Version other)
Compares this version with an other version object. |
int |
compareTo(Version other,
int limit)
Compares this version with an other version object, up to the specified limit. |
boolean |
equals(Object other)
Compare this version string with the specified object for equality. |
Comparable<?> |
getComponent(int index)
Returns the specified components of this version string. |
Comparable<?> |
getMajor()
Returns the major version number. |
Comparable<?> |
getMinor()
Returns the minor version number. |
Comparable<?> |
getRevision()
Returns the revision number. |
int |
hashCode()
Returns a hash code value for this version. |
int |
length()
Returns the length of the version string. |
CharSequence |
subSequence(int start,
int end)
Returns a new version string that is a subsequence of this sequence. |
String |
toString()
Returns the version string. |
Methods inherited from class Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final char SEPARATOR
Constructor Detail |
---|
public Version(String version)
version
- The version as a string.Method Detail |
---|
public Comparable<?> getMajor()
Integer
if possible,
or a String
otherwise.
public Comparable<?> getMinor()
Integer
if possible,
or a String
otherwise. If there is no minor version number, then this method
returns null
.
null
if none.public Comparable<?> getRevision()
Integer
if possible,
or a String
otherwise. If there is no revision number, then this method
returns null
.
null
if none.public Comparable<?> getComponent(int index)
major.minor.revision
form, index 0 stands for the major version number,
1 stands for the minor version number and 2 stands for the revision number.
The return value is an Integer
if the component is parsable as an integer,
or a String
otherwise. If there is no component at the specified index,
then this method returns null
.
index
- The index of the component to fetch.
null
if none.
IndexOutOfBoundsException
- if index
is negative.public int compareTo(Version other, int limit)
Integer
object if possible, or as String
otherwise.
other
- The other version object to compare with.limit
- The maximum number of components to compare.
public int compareTo(Version other)
compareTo(Version, int)
with no limit.
compareTo
in interface Comparable<Version>
other
- The other version object to compare with.
public boolean equals(Object other)
compareTo(other) == 0
.
equals
in class Object
other
- The object to compare with this version for equality.public int length()
length
in interface CharSequence
public char charAt(int index)
char
value at the specified index.
charAt
in interface CharSequence
public CharSequence subSequence(int start, int end)
subSequence
in interface CharSequence
public String toString()
toString
in interface CharSequence
toString
in class Object
public int hashCode()
hashCode
in class Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |