Class ComposerReleaseComparator

java.lang.Object
com.avoka.fc.core.util.ComposerReleaseComparator
All Implemented Interfaces:
Comparator<String>

public class ComposerReleaseComparator extends Object implements Comparator<String>
Provides a comparator for Composer versions
Since:
4.3.0
  • Field Details

  • Constructor Details

    • ComposerReleaseComparator

      public ComposerReleaseComparator()
  • Method Details

    • compare

      public int compare(String o1, String o2)
      Compares two release strings. Release strings are of the form x.y.zsp# where the various components are optional. eg. Some examples are 3.2, 3.4.0, 4.0.0sp3
      Specified by:
      compare in interface Comparator<String>
      Parameters:
      o1 - the first version string
      o2 - the second version string
      Returns:
      the result of the comparison
    • isLessThan

      public static boolean isLessThan(String source, String target)
      Check whether a source version is less than a target version
      Parameters:
      source - the source version
      target - the target version
      Returns:
      true if the source version is strictly less than the target version
    • isLessThanOrEqual

      public static boolean isLessThanOrEqual(String source, String target)
      Check whether a source version is less than or equal to a target version
      Parameters:
      source - the source version
      target - the target version
      Returns:
      true if the source version is less than or equal to the target version
    • isEqual

      public static boolean isEqual(String source, String target)
      Check whether a source version is equal to a target version
      Parameters:
      source - the source version
      target - the target version
      Returns:
      true if the source version is equal to the target version
    • isGreaterThan

      public static boolean isGreaterThan(String source, String target)
      Check whether a source version is greater than a target version
      Parameters:
      source - the source version
      target - the target version
      Returns:
      true if the source version is strictly greater than the target version
    • isGreaterThanOrEqual

      public static boolean isGreaterThanOrEqual(String source, String target)
      Check whether a source version is greater than or equal to a target version
      Parameters:
      source - the source version
      target - the target version
      Returns:
      true if the source version is greater than or equal to the target version