public interface Version extends Comparable<Version>
Version
instances.Modifier and Type | Field and Description |
---|---|
static String |
VERSION_PROPERTY_KEY
The key for a version property in a properties file.
|
Modifier and Type | Method and Description |
---|---|
int |
major() |
String |
metadata() |
int |
minor() |
static Version |
parse(String versionString)
Parses a string on the form x.y.z-metadata
|
static Version |
parsePropertiesFile(Class<?> resourceOwner,
String resourcePath)
Reads a properties file from the classpath and parses the value associated with the 'version' key.
|
int |
patch() |
static Version |
version() |
static Version |
version(int major)
Creates a new version [major].0.0
|
static Version |
version(int major,
int minor)
Creates a new version [major].[minor].0
|
static Version |
version(int major,
int minor,
int patch)
Creates a new version [major].[minor].[patch]
|
static Version |
version(int major,
int minor,
int patch,
String metadata)
Creates a new version [major].[minor].[patch]-[metadata]
|
static String |
versionAndMetadataString() |
static String |
versionString() |
compareTo
static final String VERSION_PROPERTY_KEY
int major()
int minor()
int patch()
String metadata()
static Version version(int major)
major
- the major versionstatic Version version(int major, int minor)
major
- the major versionminor
- the minor versionstatic Version version(int major, int minor, int patch)
major
- the major versionminor
- the minor versionpatch
- the patch versionstatic Version version(int major, int minor, int patch, String metadata)
major
- the major versionminor
- the minor versionpatch
- the patch versionmetadata
- the metadata, fx. build informationstatic String versionString()
static String versionAndMetadataString()
static Version version()
static Version parse(String versionString)
versionString
- the version stringstatic Version parsePropertiesFile(Class<?> resourceOwner, String resourcePath)
resourceOwner
- the resource owning classresourcePath
- the resource path, prefix with '/' for classpath rootVersion
instance parsed from the value associated with the 'version' property key found in the given resourceIllegalArgumentException
- in case the properties resource is not found or if no 'version' property key is found