public class AppVersion extends Object implements Comparable<AppVersion>
Constructor and Description |
---|
AppVersion()
Construct an uninitialized AppVersion.
|
AppVersion(int major,
int minor)
Creates a new major.minor version number, e.g.1.0.
|
AppVersion(int major,
int minor,
int patch)
Creates a new major.minor.patch version number, e.g.1.0.1.
|
AppVersion(int major,
int minor,
int patch,
int milestone,
String modifier)
Creates a new major.minor.patchMmilestone-modifier version number, e.g.1.0.1M1-SNAPSHOT.
|
AppVersion(int major,
int minor,
int patch,
int milestone,
String modifier,
String build)
Creates a new version number
|
AppVersion(int major,
int minor,
int patch,
String modifier)
Creates a new major.minor.patch-modifier version number, e.g.1.0.1-SNAPSHOT.
|
AppVersion(int major,
int minor,
String modifier)
Creates a new major.minor-modifier version number, e.g.1.0-beta1.
|
Modifier and Type | Method and Description |
---|---|
int |
compareTo(AppVersion other)
Compares two version numbers according to their major, minor, patch and milestone version numbers, ordering from
oldest to newest version.
|
boolean |
equals(Object other)
Check if two versions are exactly equal, modifier is case insensitive.
|
int |
getMajor()
Gets the version's major version number.
|
int |
getMilestone()
Get the milestone number
|
int |
getMinor()
Gets the version's minor version number.
|
String |
getModifier()
Gets the version's release modifier part.
|
int |
getPatch()
Gets the version's micro version / patch level number.
|
int |
hashCode() |
boolean |
newerThan(AppVersion other)
Checks if this version is newer than the specified version, according to the result of
compareTo(AppVersion) . |
boolean |
olderThan(AppVersion other)
Checks if this version is older than the specified version, according to the result of
compareTo(AppVersion) . |
static AppVersion |
parse(String versionString)
Parses a version string into a Version object.
|
void |
setMajor(int major)
Set major number
|
void |
setMilestone(int milestone)
Set the milestone number
|
void |
setMinor(int minor)
Set minor number
|
void |
setModifier(String modifier)
Set the version's release modifier part.
|
void |
setPatch(int micro)
Sets the version's micro version / patch level number.
|
String |
toString()
Returns the string represention of this version.
|
public AppVersion()
public AppVersion(int major, int minor)
major
- major numberminor
- minor numberpublic AppVersion(int major, int minor, int patch)
major
- major numberminor
- minor numberpatch
- patch numberpublic AppVersion(int major, int minor, String modifier)
major
- major numberminor
- minor numbermodifier
- additional stringpublic AppVersion(int major, int minor, int patch, String modifier)
major
- major numberminor
- minor numberpatch
- patch numbermodifier
- additional stringpublic AppVersion(int major, int minor, int patch, int milestone, String modifier)
major
- major numberminor
- minor numberpatch
- patch numbermilestone
- milestone numbermodifier
- additional stringpublic int getMajor()
public void setMajor(int major)
major
- major numberpublic int getMinor()
public void setMinor(int minor)
minor
- minor numberpublic int getPatch()
public void setPatch(int micro)
micro
- patch level numberpublic void setMilestone(int milestone)
milestone
- milestone numberpublic int getMilestone()
public String getModifier()
public void setModifier(String modifier)
modifier
- modifier stringpublic boolean equals(Object other)
public boolean olderThan(AppVersion other)
compareTo(AppVersion)
.other
- other versionpublic boolean newerThan(AppVersion other)
compareTo(AppVersion)
.other
- other versionpublic int compareTo(AppVersion other)
compareTo
in interface Comparable<AppVersion>
other
- public static AppVersion parse(String versionString)
versionString
- A version string, e.g. 1.0.1 or 1.0-beta1.NumberFormatException
- If versionString could not be parsed to a version.Copyright © 2015-2019 Eclipse Foundation. All Rights Reserved.