- All Superinterfaces:
Comparable<Version>
Specifies a version and serves as a factory class for
Version instances.-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringThe key for a version property in a properties file. -
Method Summary
Modifier and TypeMethodDescriptionintmajor()metadata()intminor()static VersionParses a string on the form x.y.z-metadatastatic VersionparsePropertiesFile(Class<?> resourceOwner, String resourcePath) Reads a properties file from the classpath and parses the value associated with the 'version' key.intpatch()static Versionversion()static Versionversion(int major) Creates a new version [major].0.0static Versionversion(int major, int minor) Creates a new version [major].[minor].0static Versionversion(int major, int minor, int patch) Creates a new version [major].[minor].[patch]static VersionCreates a new version [major].[minor].[patch]-[metadata]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.
-
-
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
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
-