|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
ObjectVersion
@Immutable public class Version
Holds a version number as a sequence of strings separated by either a dot or a dash.
The first three strings, usually numbers, are called respectively major,
minor and revision. For example an
EPSG database version code, such as "6.11.2", will have major number 6, minor
number 11 and revision number 2. Alternatively a Maven version code, such as
"3.18-SNAPSHOT", will have major version number 3, minor version number 18
and revision string "SNAPSHOT".
This class provides methods for performing comparisons of Version objects where
major, minor and revision parts are compared as numbers when possible, or as strings otherwise.
Versioned,
Serialized Form
| utility/geotk-utility (download) | View source code for this class |
| Field Summary | |
|---|---|
static Version |
GEOTOOLKIT
The version of this Geotoolkit.org distribution. |
static String |
SEPARATORS
The separator characters 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 Version GEOTOOLKIT
public static final String SEPARATORS
| 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 Objectother - The object to compare with this version for equality.public int length()
length in interface CharSequencepublic char charAt(int index)
char value at the specified index.
charAt in interface CharSequence
public CharSequence subSequence(int start,
int end)
subSequence in interface CharSequencepublic String toString()
toString in interface CharSequencetoString in class Objectpublic int hashCode()
hashCode in class Object
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||