- All Superinterfaces:
Comparable<Version>
Specifies a version and serves as a factory for
Version.Builder instances.-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringThe key for a version property in a properties file. -
Method Summary
Modifier and TypeMethodDescriptionbuild()static Version.Builderbuilder()intmajor()metadata()intminor()static VersionReads a properties file from the classpath and parses the value associated with the 'version' key.static VersionParses a string on the form x.y.z-metadata+buildintpatch()static Versionversion()static Stringstatic StringMethods inherited from interface java.lang.Comparable
compareTo
-
Field Details
-
VERSION_PROPERTY_KEY
The key for a version property in a properties file.- See Also:
-
-
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
- Returns:
- the metadata part of this version or an empty Optional in case of no metadata
-
build
- Returns:
- the build information part of this version or an empty Optional in case of no build information
-
builder
- Returns:
- a new
Version.Builderinstance.
-
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+build- Parameters:
versionString- the version string- Returns:
- a Version based on the given string
- Throws:
NullPointerException- in caseversionStringis nullIllegalArgumentException- in caseversionStringis empty
-
parse
Reads a properties file from the classpath and parses the value associated with the 'version' key.- Parameters:
resourceOwner- the resource owning classversionFileResourcePath- the resource path to the file containing the version, prefix with '/' for classpath root- Returns:
- a
Versioninstance 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
-