Interface Version

All Superinterfaces:
Comparable<Version>

public interface Version extends Comparable<Version>
Specifies a version and serves as a factory class for Version instances.
  • Field Details

  • 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

      static Version version(int major)
      Creates a new version [major].0.0
      Parameters:
      major - the major version
      Returns:
      a Version
    • version

      static Version version(int major, int minor)
      Creates a new version [major].[minor].0
      Parameters:
      major - the major version
      minor - the minor version
      Returns:
      a Version
    • version

      static Version version(int major, int minor, int patch)
      Creates a new version [major].[minor].[patch]
      Parameters:
      major - the major version
      minor - the minor version
      patch - the patch version
      Returns:
      a Version
    • version

      static Version version(int major, int minor, int patch, String metadata)
      Creates a new version [major].[minor].[patch]-[metadata]
      Parameters:
      major - the major version
      minor - the minor version
      patch - the patch version
      metadata - the metadata, fx. build information
      Returns:
      a Version
    • versionString

      static String versionString()
      Returns:
      a string containing the framework version number, without any version metadata (fx. build no.)
    • versionAndMetadataString

      static String versionAndMetadataString()
      Returns:
      a string containing the framework version and version metadata
    • version

      static Version version()
      Returns:
      the framework Version
    • parse

      static Version parse(String versionString)
      Parses a string on the form x.y.z-metadata
      Parameters:
      versionString - the version string
      Returns:
      a Version based on the given string
    • parsePropertiesFile

      static Version parsePropertiesFile(Class<?> resourceOwner, String resourcePath)
      Reads a properties file from the classpath and parses the value associated with the 'version' key.
      Parameters:
      resourceOwner - the resource owning class
      resourcePath - 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