- All Superinterfaces:
Comparable<Version>
Specifies a version and serves as a factory class for
Version
instances.-
Field Summary
Modifier and TypeFieldDescriptionstatic final String
The key for a version property in a properties file. -
Method Summary
Modifier and TypeMethodDescriptionint
major()
metadata()
int
minor()
static Version
Parses a string on the form x.y.z-metadatastatic 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.0static Version
version
(int major, int minor) Creates a new version [major].[minor].0static Version
version
(int major, int minor, int patch) Creates a new version [major].[minor].[patch]static Version
Creates a new version [major].[minor].[patch]-[metadata]static String
static String
Methods inherited from interface java.lang.Comparable
compareTo
-
Field Details
-
VERSION_PROPERTY_KEY
The key for a version property in a properties file.
-
-
Method Details
-
major
int major()- Returns:
- the major part of this version
-
minor
int minor()- Returns:
- the minor part of this version
-
patch
int patch()- Returns:
- the patch part of this version
-
metadata
String metadata()- Returns:
- the metadata part of this version
-
version
Creates a new version [major].0.0- Parameters:
major
- the major version- Returns:
- a Version
-
version
Creates a new version [major].[minor].0- Parameters:
major
- the major versionminor
- the minor version- Returns:
- a Version
-
version
Creates a new version [major].[minor].[patch]- Parameters:
major
- the major versionminor
- the minor versionpatch
- the patch version- Returns:
- a Version
-
version
Creates a new version [major].[minor].[patch]-[metadata]- Parameters:
major
- the major versionminor
- the minor versionpatch
- the patch versionmetadata
- the metadata, fx. build information- Returns:
- a Version
-
versionString
- Returns:
- a string containing the framework version number, without any version metadata (fx. build no.)
-
versionAndMetadataString
- Returns:
- a string containing the framework version and version metadata
-
version
- Returns:
- the framework Version
-
parse
Parses a string on the form x.y.z-metadata- Parameters:
versionString
- the version string- Returns:
- a Version based on the given string
-
parsePropertiesFile
Reads a properties file from the classpath and parses the value associated with the 'version' key.- Parameters:
resourceOwner
- the resource owning classresourcePath
- the resource path, prefix with '/' for classpath root- Returns:
- a
Version
instance parsed from the value associated with the 'version' property key found in the given resource - Throws:
IllegalArgumentException
- in case the properties resource is not found or if no 'version' property key is found
-