Interface VersionMatcher

  • All Known Implementing Classes:
    FixedVersionMatcher, VersionPatternMatcher

    public interface VersionMatcher
    Utility class to determine tle latest version among a set of versions. The #COMPARATOR provides the implementation to compare the versions. The latest one is the "last" determine by this comparator. This comparator first compares the epoch of the versions ([epoch:]version). If present, the epoch MUST be an integer. This comparator will split the versions (using non-digit characters such as ".") to determine their digits and compare them numerically. The comparator will determine that "1.0.10" is later than "1.0.2" (because 10 > 2). If the versions contains characters, they are sorted in their lexical order. The comparator will determine that "1.0.0.RC1" is later than "1.0.0.Final" (because "RC1" is after "Final").
    • Field Detail

      • COMPARATOR

        static final Comparator<String> COMPARATOR
        Copied from https://raw.githubusercontent.com/wolfc/updepres/master/model/src/main/java/org/jboss/up/depres/version/VersionComparator.java FIXME: proper attribution
    • Method Detail

      • getLatestVersion

        static Optional<String> getLatestVersion​(Set<String> versions)
        Determine the latest version among the parameters based on the COMPARATOR.
        Parameters:
        versions - a Set of versions
        Returns:
        an Optional of the latest version.