public class Version extends Object implements Comparable<Version>
Constructor and Description |
---|
Version(int newMajor)
Constructs a new Version object with the specified parameters.
|
Version(int newMajor,
int newMinor)
Constructs a new Version object with the specified parameters.
|
Version(int newMajor,
int newMinor,
int newRevision)
Constructs a new Version object with the specified parameters.
|
Version(int newMajor,
int newMinor,
int newRevision,
String newTag)
Constructs a new version object with the specified parameters.
|
Modifier and Type | Method and Description |
---|---|
int |
compareTo(Version version)
Compares two versions objects.
|
int |
compareTo(Version version,
boolean noTagsAreNewer)
Compares two versions objects.
|
boolean |
equals(Object obj)
Determines whether the specified object is equal to this object.
|
int |
getMajor()
Gets the version major number.
|
int |
getMinor()
Gets the version minor number.
|
int |
getRevision()
Gets the version revision number.
|
String |
getTag()
Gets the version tag string.
|
int |
hashCode()
Returns a hash code for this object.
|
static Version |
parseFromString(String version)
Parses a new Version object from a string.
|
Version |
setMajor(int newMajor)
Sets the version major number.
|
Version |
setMinor(int newMinor)
Sets the version minor number.
|
Version |
setRevision(int newRevision)
Sets the version revision number.
|
Version |
setTag(String newTag)
Sets the version tag string.
|
String |
toString()
Returns a String representation of this object.
|
public Version(int newMajor, int newMinor, int newRevision, String newTag)
newMajor
- The version major numbernewMinor
- The version minor numbernewRevision
- The version revision numbernewTag
- The version tag stringpublic Version(int newMajor, int newMinor, int newRevision)
newMajor
- The version major numbernewMinor
- The version minor numbernewRevision
- The version revision numberpublic Version(int newMajor, int newMinor)
newMajor
- The version major numbernewMinor
- The version minor numberpublic Version(int newMajor)
newMajor
- The version major numberpublic static Version parseFromString(String version)
version
- The version string to parsepublic final int hashCode()
hashCode
in class Object
Object.hashCode()
public final boolean equals(Object obj)
equals
in class Object
obj
- The object to compare to this objecttrue
if the specified object is equal to this object, false
otherwiseObject.equals(java.lang.Object)
public final String toString()
toString
in class Object
Object.toString()
public final int compareTo(Version version)
String.compareTo()
. Having
no tag is considered a newer version than a version with a tag.compareTo
in interface Comparable<Version>
version
- The version to compare this version to0
if the version is equal to this version, 1
if the version is greater than
this version, or -1
if the version is lower than this version.public final int compareTo(Version version, boolean noTagsAreNewer)
String.compareTo()
.version
- The version to compare this version tonoTagsAreNewer
- Whether versions with no tag are considered newer than those that have tags0
if the version is equal to this version, 1
if the version is greater than
this version, or -1
if the version is lower than this version.public int getMajor()
public Version setMajor(int newMajor)
newMajor
- The major version number to setpublic int getMinor()
public Version setMinor(int newMinor)
newMinor
- The version minor number to setpublic int getRevision()
public Version setRevision(int newRevision)
newRevision
- The revision number to setpublic String getTag()
Copyright © 2011–2019. All rights reserved.