Class VersionHelper

java.lang.Object
io.bdeploy.common.util.VersionHelper

public class VersionHelper extends Object
  • Field Details

    • UNDEFINED

      public static final Version UNDEFINED
  • Method Details

    • getVersion

      public static Version getVersion()
    • getVersionAsString

      public static String getVersionAsString()
    • getProperties

      public static Properties getProperties()
    • compare

      public static int compare(String a, String b)
      Parses and compares the two version object. An exception is thrown if one of the strings does not represent a valid version.
      Parameters:
      a - first version to compare
      b - second version to compare
      Returns:
      a negative integer, zero, or a positive integer as this version is less than, equal to, or greater than the specified version.
    • compare

      public static int compare(Version a, Version b)
      Compares the two versions taking null into account. If both versions are null then they are assumed to be equal. Otherwise null is treated as lower than any other version.
      Parameters:
      a - first version to compare
      b - second version to compare
      Returns:
      a negative integer, zero, or a positive integer as this version is less than, equal to, or greater than the specified version.
    • equals

      public static boolean equals(Version a, Version b)
      Compares whether or not the two versions are equal.
    • parse

      public static Version parse(String v)
      Parses the given string into a version. Throws an exception if parsing fails.
      Parameters:
      v - the string to parse
      Returns:
      the version object. Never null
    • tryParse

      public static Version tryParse(String v)
      Tries to parse the given string into a version object.
      Parameters:
      v - the string to parse
      Returns:
      the version object or null in case that the string is not a version
    • isRunningUndefined

      public static boolean isRunningUndefined()
      Returns whether or not the currently running version is undefined. Typically happens when starting the minion in the development environment.
    • isUndefined

      public static boolean isUndefined(Version version)
      Returns whether or not the given version represents the undefined version.