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
FieldsModifier and TypeFieldDescriptionfinal StringDeprecated.final StringDeprecated.UsegetVersion()static final VersionReads the current version from the classpath, using version.properties and git.properties.final intDeprecated.UsegetVersion()final intDeprecated.UsegetVersion()final intDeprecated.UsegetVersion() -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintbooleanstatic Versionfrom(int major, int minor, int patch) Build validVersionfrom major, minor, and patch version ("X.Y.Z").static VersionBuild validVersionfrom major, minor, and patch version ("X.Y.Z").static VersionBuild validVersionfrom major, minor, and patch version ("X.Y.Z").static VersionfromClasspathProperties(Class<?> clazz, String path, String propertyName, String gitPath, String gitPropertyName, Version defaultVersion) Try to read the version frompath(propertyNameproperty) andgitPath(gitPropertyNameproperty) from the classpath.static VersionfromClasspathProperties(String path, String propertyName, String gitPath, String gitPropertyName, Version defaultVersion) Try to read the version frompath(propertyNameproperty) andgitPath(gitPropertyNameproperty) from the classpath.static VersionfromClasspathProperties(String path, String gitPath, Version defaultVersion) Try to read the version frompath(project.versionproperty) andgitPath(git.commit.idproperty) from the classpath.static VersionfromClasspathProperties(Version defaultVersion) Try to read the version from version.properties (project.versionproperty) and git.properties (git.commit.idproperty) from the classpath.static VersionfromPluginProperties(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.idproperty) from the classpath..static VersionfromPluginProperties(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.VersionbooleangreaterMinor(Version other) Deprecated.inthashCode()booleansameOrHigher(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 validVersionfrom 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
Versioninstance built from the given parameters.
-
from
Build validVersionfrom 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
Versioninstance built from the given parameters.
-
from
public static Version from(int major, int minor, int patch, String preRelease, String buildMetadata) Build validVersionfrom 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
Versioninstance 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- TheVersionto 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.idproperty) 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- TheVersionto return if reading the information from the properties files failed.
-
fromClasspathProperties
Try to read the version from version.properties (project.versionproperty) and git.properties (git.commit.idproperty) from the classpath.- Parameters:
defaultVersion- TheVersionto return if reading the information from the properties files failed.
-
fromClasspathProperties
Try to read the version frompath(project.versionproperty) andgitPath(git.commit.idproperty) 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- TheVersionto 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(propertyNameproperty) andgitPath(gitPropertyNameproperty) 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- TheVersionto 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(propertyNameproperty) andgitPath(gitPropertyNameproperty) 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- TheVersionto return if reading the information from the properties files failed.
-
getVersion
public com.github.zafarkhaja.semver.Version getVersion()- Returns:
- the underlying
Versioninstance.
-
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-Versionto compare
-
sameOrHigher
- See Also:
-
Version.greaterThanOrEqualTo(com.github.zafarkhaja.semver.Version)
-
equals
-
hashCode
public int hashCode() -
compareTo
- Specified by:
compareToin interfaceComparable<Version>
-
getVersion()