public class Version extends Object implements Comparable<Version>
| Modifier and Type | Field and Description |
|---|---|
String |
abbrevCommitSha
Deprecated.
Use
getVersion() |
String |
additional
Deprecated.
Use
getVersion() |
static Version |
CURRENT_CLASSPATH
Reads the current version from the classpath, using version.properties and git.properties.
|
int |
major
Deprecated.
Use
getVersion() |
int |
minor
Deprecated.
Use
getVersion() |
int |
patch
Deprecated.
Use
getVersion() |
| Constructor and Description |
|---|
Version(int major,
int minor,
int patch)
Deprecated.
|
Version(int major,
int minor,
int patch,
String additional)
Deprecated.
|
Version(int major,
int minor,
int patch,
String additional,
String abbrevCommitSha)
Deprecated.
|
Version(com.github.zafarkhaja.semver.Version version) |
| Modifier and Type | Method and Description |
|---|---|
int |
compareTo(Version that) |
boolean |
equals(Object o) |
static Version |
from(int major,
int minor,
int patch)
Build valid
Version from major, minor, and patch version ("X.Y.Z"). |
static Version |
from(int major,
int minor,
int patch,
String preRelease)
Build valid
Version from major, minor, and patch version ("X.Y.Z"). |
static Version |
from(int major,
int minor,
int patch,
String preRelease,
String buildMetadata)
Build valid
Version from major, minor, and patch version ("X.Y.Z"). |
static Version |
fromClasspathProperties(String path,
String propertyName,
String gitPath,
String gitPropertyName,
Version defaultVersion)
Try to read the version from
path (propertyName property)
and gitPath (gitPropertyName property) from the classpath. |
static Version |
fromClasspathProperties(String path,
String gitPath,
Version defaultVersion)
Try to read the version from
path (project.version property)
and gitPath (git.commit.id property) from the classpath. |
static Version |
fromClasspathProperties(Version defaultVersion)
Try to read the version from version.properties (
project.version property)
and git.properties (git.commit.id property) from the classpath. |
com.github.zafarkhaja.semver.Version |
getVersion() |
boolean |
greaterMinor(Version other)
Deprecated.
|
int |
hashCode() |
boolean |
sameOrHigher(Version other) |
String |
toString() |
@Deprecated public final int major
getVersion()@Deprecated public final int minor
getVersion()@Deprecated public final int patch
getVersion()@Deprecated public final String additional
getVersion()@Deprecated public final String abbrevCommitSha
getVersion()public static final Version CURRENT_CLASSPATH
@Deprecated public Version(int major, int minor, int patch)
Version(com.github.zafarkhaja.semver.Version) or from(int, int, int)@Deprecated public Version(int major, int minor, int patch, String additional)
Version(com.github.zafarkhaja.semver.Version) or from(int, int, int, String)@Deprecated public Version(int major, int minor, int patch, String additional, String abbrevCommitSha)
Version(com.github.zafarkhaja.semver.Version)public Version(com.github.zafarkhaja.semver.Version version)
public static Version from(int major, int minor, int patch)
Version from major, minor, and patch version ("X.Y.Z").major - The major version component.minor - The minor version component.patch - The patch version component.Version instance built from the given parameters.public static Version from(int major, int minor, int patch, String preRelease)
Version from major, minor, and patch version ("X.Y.Z").major - The major version component.minor - The minor version component.patch - The patch version component.preRelease - The pre-release version component.Version instance built from the given parameters.public static Version from(int major, int minor, int patch, String preRelease, String buildMetadata)
Version from major, minor, and patch version ("X.Y.Z").major - The major version component.minor - The minor version component.patch - The patch version component.preRelease - The pre-release version component.buildMetadata - Additional build metadata (e. g. the Git commit SHA).Version instance built from the given parameters.public static Version fromClasspathProperties(Version defaultVersion)
project.version property)
and git.properties (git.commit.id property) from the classpath.defaultVersion - The Version to return if reading the information from the properties files failed.public static Version fromClasspathProperties(String path, String gitPath, Version defaultVersion)
path (project.version property)
and gitPath (git.commit.id property) from the classpath.path - Path of the properties file on the classpath which contains the version information.gitPath - Path of the properties file on the classpath which contains the SCM information.defaultVersion - The Version to return if reading the information from the properties files failed.public static Version fromClasspathProperties(String path, String propertyName, String gitPath, String gitPropertyName, Version defaultVersion)
path (propertyName property)
and gitPath (gitPropertyName property) from the classpath.path - Path of the properties file on the classpath which contains the version information.propertyName - The name of the property to read as project version ("major.minor.patch-preReleaseVersion").gitPath - Path of the properties file on the classpath which contains the SCM information.gitPropertyName - The name of the property to read as git commit SHA.defaultVersion - The Version to return if reading the information from the properties files failed.public com.github.zafarkhaja.semver.Version getVersion()
Version instance.@Deprecated public boolean greaterMinor(Version other)
other - Version to comparepublic boolean sameOrHigher(Version other)
Version.greaterThanOrEqualTo(com.github.zafarkhaja.semver.Version)public int compareTo(@Nonnull Version that)
compareTo in interface Comparable<Version>Copyright © 2012-2016 Graylog, Inc.. All Rights Reserved.