|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.usergrid.utils.Version
public class Version
The Version class can be used to parse a standard version string into its four components, MAJOR.MINOR.BUILD.REVISION.
Constructor Summary | |
---|---|
Version()
Initialize a new Version object that is set to "0.0.0.0". |
Method Summary | |
---|---|
void |
addBuild(int toAdd)
Adds a whole (positive or negative) integer to the BUILD component of the version. |
void |
addMajor(int toAdd)
Adds a whole (positive or negative) integer to the MAJOR component of the version. |
void |
addMinor(int toAdd)
Adds a whole (positive or negative) integer to the MINOR component of the version. |
void |
addRevision(int toAdd)
Adds a whole (positive or negative) integer to the REVISION component of the version. |
Object |
clone()
|
int |
compareTo(Version toCompare)
|
boolean |
equals(Object toCompare)
|
String |
getBuild()
Gets the version's BUILD component. |
String |
getMajor()
Gets the version's MAJOR component. |
String |
getMinor()
Gets the version's MINOR component. |
int |
getNumberOfComponents()
Gets the number of components that make up the version. |
String |
getPrefix()
Gets everything before the version in the string that was parsed. |
String |
getRevision()
Gets the version's REVISION component. |
String |
getSuffix()
Gets everything after the version in the string that was parsed. |
int |
hashCode()
|
static Version |
parse(String toParse)
Parses a new Version object from a String. |
void |
setBuild(int toSet)
Sets the version's BUILD component. |
void |
setBuild(String toSet)
Sets the version's BUILD component. |
void |
setMajor(int toSet)
Sets the version's MAJOR component. |
void |
setMajor(String toSet)
Sets the version's MAJOR component. |
void |
setMinor(int toSet)
Sets the version's MINOR component. |
void |
setMinor(String toSet)
Sets the version's MINOR component. |
void |
setNumberOfComponents(int toSet)
Sets the number of components that make up the version. |
void |
setRevision(int toSet)
Sets the version's REVISION component. |
void |
setRevision(String toSet)
Sets the version's REVISION component. |
String |
toString()
|
String |
toString(int components)
Gets the version as a string using the specified number of components. |
String |
toStringRaw()
Gets the string that was parsed to create this Version object. |
String |
toStringWithPrefixAndSuffix()
Gets the version as a string including the prefix and suffix. |
String |
toStringWithPrefixAndSuffix(int components)
Gets the version as a string including the prefix and suffix using the specified number of components. |
Methods inherited from class java.lang.Object |
---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public Version()
Method Detail |
---|
public String toStringRaw()
public String getPrefix()
public String getSuffix()
public static Version parse(String toParse) throws Exception
toParse
- The String object to parse.
Exception
- When there is an error parsing the String.public String getMajor()
public void setMajor(String toSet) throws IllegalArgumentException
toSet
- The version's MAJOR component.
IllegalArgumentException
- When a null or non-numeric value is given.public void setMajor(int toSet)
toSet
- The version's MAJOR component.public String getMinor()
public void setMinor(String toSet) throws IllegalArgumentException
toSet
- The version's MINOR component.
IllegalArgumentException
- When a null or non-numeric value is given.public void setMinor(int toSet)
toSet
- The version's MINOR component.public String getBuild()
public void setBuild(String toSet) throws IllegalArgumentException
toSet
- The version's BUILD component.
IllegalArgumentException
- When a null or non-numeric value is given.public void setBuild(int toSet)
toSet
- The version's BUILD component.public String getRevision()
public void setRevision(String toSet) throws IllegalArgumentException
toSet
- The version's REVISION component.
IllegalArgumentException
- When a null or non-numeric value is given.public void setRevision(int toSet)
toSet
- The version's REVISION component.public int getNumberOfComponents()
public void setNumberOfComponents(int toSet)
toSet
- The number of components that make up the version. Values less
than 1 are treated as 1. Values greater than 4 are treated as
4.public Object clone() throws CloneNotSupportedException
clone
in class Object
CloneNotSupportedException
public boolean equals(Object toCompare)
equals
in class Object
public int hashCode()
hashCode
in class Object
public String toString()
toString
in class Object
public String toStringWithPrefixAndSuffix()
public String toString(int components)
components
- The number of components. Values less than 1 will be treated
as 1 and values greater than 4 will be treated as 4.
public String toStringWithPrefixAndSuffix(int components)
components
- The number of components. Values less than 1 will be treated
as 1 and values greater than 4 will be treated as 4.
public int compareTo(Version toCompare)
compareTo
in interface Comparable<Version>
public void addMajor(int toAdd)
toAdd
- A whole (positive or negative) integer.public void addMinor(int toAdd)
toAdd
- A whole (positive or negative) integer.public void addBuild(int toAdd)
toAdd
- A whole (positive or negative) integer.public void addRevision(int toAdd)
toAdd
- A whole (positive or negative) integer.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |