Package dev.galasa

Class ProductVersion

java.lang.Object
dev.galasa.ProductVersion
All Implemented Interfaces:
Comparable<ProductVersion>

public class ProductVersion extends Object implements Comparable<ProductVersion>
A ProductVersion represents a {version}.{release}.{modification} level way of semantic numbering. where {version} {release} and {modification} are integers, joined with a period. This class allows you to create versions which can then be compared.
  • Field Details

    • patternVersion

      protected static final Pattern patternVersion
  • Constructor Details

    • ProductVersion

      public ProductVersion(int version, int release, int modification) throws ManagerException
      Parameters:
      version -
      release -
      modification -
      Throws:
      ManagerException - When any of the numbers are negative.
    • ProductVersion

      public ProductVersion(ProductVersion productVersion)
  • Method Details

    • v

      public static ProductVersion v(int version)
      Note. Using this method is less efficient than using the class constructor.
      Parameters:
      version - A version number. Negative numbers are treated as 0.
      Returns:
      A ProductVersion which has the specified version, but the release and modification are zero.
    • r

      public ProductVersion r(int release)
      Note. Using this method is less efficient than using the class constructor.
      Parameters:
      version - A version number. Negative numbers are treated as 0.
      Returns:
      A ProductVersion which has the the specified release
    • m

      public ProductVersion m(int modification)
      Note. Using this method is less efficient than using the class constructor.
      Parameters:
      version - A version number. Negative numbers are treated as 0.
      Returns:
      A ProductVersion which has the the specified modification level
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • equals

      public boolean equals(@NotNull @NotNull Object other)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • compareTo

      public int compareTo(@NotNull @NotNull ProductVersion o)
      Specified by:
      compareTo in interface Comparable<ProductVersion>
    • isEarlierThan

      public boolean isEarlierThan(@NotNull @NotNull ProductVersion o)
    • isLaterThan

      public boolean isLaterThan(@NotNull @NotNull ProductVersion o)
    • parse

      public static ProductVersion parse(@NotNull @NotNull String versionString) throws ManagerException
      Throws:
      ManagerException