Package org.graylog2.plugin
Class Version
java.lang.Object
org.graylog2.plugin.Version
- All Implemented Interfaces:
Comparable<Version>
Following the Semantic Versioning specification.
-
Field Summary
Modifier and TypeFieldDescriptionfinal String
Deprecated.final String
Deprecated.UsegetVersion()
static final Version
Reads the current version from the classpath, using version.properties and git.properties.final int
Deprecated.UsegetVersion()
final int
Deprecated.UsegetVersion()
final int
Deprecated.UsegetVersion()
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionint
boolean
static Version
from
(int major, int minor, int patch) Build validVersion
from major, minor, and patch version ("X.Y.Z").static Version
Build validVersion
from major, minor, and patch version ("X.Y.Z").static Version
Build validVersion
from major, minor, and patch version ("X.Y.Z").static Version
fromClasspathProperties
(Class<?> clazz, String path, String propertyName, String gitPath, String gitPropertyName, Version defaultVersion) Try to read the version frompath
(propertyName
property) andgitPath
(gitPropertyName
property) from the classpath.static Version
fromClasspathProperties
(String path, String propertyName, String gitPath, String gitPropertyName, Version defaultVersion) Try to read the version frompath
(propertyName
property) andgitPath
(gitPropertyName
property) from the classpath.static Version
fromClasspathProperties
(String path, String gitPath, Version defaultVersion) Try to read the version frompath
(project.version
property) andgitPath
(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.static Version
fromPluginProperties
(Class<?> pluginClass, String path, String propertyName, String gitPath, String gitPropertyName, Version defaultVersion) Try to read the version from the graylog-plugin.properties file included in a plugin and git.properties (git.commit.id
property) from the classpath..static Version
fromPluginProperties
(Class<?> pluginClass, String path, String propertyName, Version defaultVersion) Try to read the version from the graylog-plugin.properties file included in a plugin.com.github.zafarkhaja.semver.Version
boolean
greaterMinor
(Version other) Deprecated.int
hashCode()
boolean
sameOrHigher
(Version other) toString()
-
Field Details
-
major
Deprecated.UsegetVersion()
-
minor
Deprecated.UsegetVersion()
-
patch
Deprecated.UsegetVersion()
-
additional
Deprecated.UsegetVersion()
-
abbrevCommitSha
Deprecated.UsegetVersion()
-
CURRENT_CLASSPATH
Reads the current version from the classpath, using version.properties and git.properties.
-
-
Constructor Details
-
Version
Deprecated. -
Version
Deprecated. -
Version
@Deprecated public Version(int major, int minor, int patch, String additional, String abbrevCommitSha) Deprecated. -
Version
public Version(com.github.zafarkhaja.semver.Version version)
-
-
Method Details
-
from
Build validVersion
from major, minor, and patch version ("X.Y.Z").- Parameters:
major
- The major version component.minor
- The minor version component.patch
- The patch version component.- Returns:
- The
Version
instance built from the given parameters.
-
from
Build validVersion
from major, minor, and patch version ("X.Y.Z").- Parameters:
major
- The major version component.minor
- The minor version component.patch
- The patch version component.preRelease
- The pre-release version component.- Returns:
- The
Version
instance built from the given parameters.
-
from
public static Version from(int major, int minor, int patch, String preRelease, String buildMetadata) Build validVersion
from major, minor, and patch version ("X.Y.Z").- Parameters:
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).- Returns:
- The
Version
instance built from the given parameters.
-
fromPluginProperties
public static Version fromPluginProperties(Class<?> pluginClass, String path, String propertyName, Version defaultVersion) Try to read the version from the graylog-plugin.properties file included in a plugin.- Parameters:
pluginClass
- Class where the class loader should be obtained from.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").defaultVersion
- TheVersion
to return if reading the information from the properties files failed.
-
fromPluginProperties
public static Version fromPluginProperties(Class<?> pluginClass, String path, String propertyName, String gitPath, String gitPropertyName, Version defaultVersion) Try to read the version from the graylog-plugin.properties file included in a plugin and git.properties (git.commit.id
property) from the classpath..- Parameters:
pluginClass
- Class where the class loader should be obtained from.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
- TheVersion
to return if reading the information from the properties files failed.
-
fromClasspathProperties
Try to read the version from version.properties (project.version
property) and git.properties (git.commit.id
property) from the classpath.- Parameters:
defaultVersion
- TheVersion
to return if reading the information from the properties files failed.
-
fromClasspathProperties
Try to read the version frompath
(project.version
property) andgitPath
(git.commit.id
property) from the classpath.- Parameters:
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
- TheVersion
to return if reading the information from the properties files failed.
-
fromClasspathProperties
public static Version fromClasspathProperties(String path, String propertyName, String gitPath, String gitPropertyName, Version defaultVersion) Try to read the version frompath
(propertyName
property) andgitPath
(gitPropertyName
property) from the classpath.- Parameters:
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
- TheVersion
to return if reading the information from the properties files failed.
-
fromClasspathProperties
public static Version fromClasspathProperties(@Nonnull Class<?> clazz, String path, String propertyName, String gitPath, String gitPropertyName, Version defaultVersion) Try to read the version frompath
(propertyName
property) andgitPath
(gitPropertyName
property) from the classpath.- Parameters:
clazz
- Class where the class loader should be obtained from.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
- TheVersion
to return if reading the information from the properties files failed.
-
getVersion
public com.github.zafarkhaja.semver.Version getVersion()- Returns:
- the underlying
Version
instance.
-
toString
-
greaterMinor
Deprecated.Check if this version is higher than the passed other version. Only taking major and minor version number in account.- Parameters:
other
-Version
to compare
-
sameOrHigher
- See Also:
-
Version.greaterThanOrEqualTo(com.github.zafarkhaja.semver.Version)
-
equals
-
hashCode
public int hashCode() -
compareTo
- Specified by:
compareTo
in interfaceComparable<Version>
-
getVersion()