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 TypeFieldDescriptionstatic final VersionReads the current version from the classpath, using version.properties and git.properties. -
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.VersioninthashCode()booleansameOrHigher(Version other) toString()
-
Field Details
-
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(long major, long minor, long 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
-
sameOrHigher
- See Also:
-
Version.isHigherThanOrEquivalentTo(com.github.zafarkhaja.semver.Version)
-
equals
-
hashCode
public int hashCode() -
compareTo
- Specified by:
compareToin interfaceComparable<Version>
-
Version(com.github.zafarkhaja.semver.Version)orfrom(int, int, int)