Class VersionPrefixRestriction

  • All Implemented Interfaces:
    Restriction

    public class VersionPrefixRestriction
    extends Object
    implements Restriction
    Restricts candidate versions to those that match specified version prefix. E.g. `prefix` "1.1" matches versions "1.1", "1.1.1", "1.1.2-qualifier", but doesn't match versions "1.10" or "1.2". This restriction also allows to specify `remainderRegex`, which is a regular expression pattern that's gonna be used to match remaining part of the version (the part not covered by the `prefix`). E.g. `prefix` "1.1" with `remainderRegex` "redhat-\\d+" would match versions "1.1.redhat-00001" or "1.1-redhat-00001" but not version "1.1.1.redhat-00001" (i.e. micro being added where it was originally missing is not accepted).
    • Constructor Detail

      • VersionPrefixRestriction

        public VersionPrefixRestriction​(String prefixString)
      • VersionPrefixRestriction

        public VersionPrefixRestriction​(String prefix,
                                        String remainderRegex)
    • Method Detail

      • applies

        public boolean applies​(String versionString,
                               String originalVersion)
        Description copied from interface: Restriction
        Applies the restriction.
        Specified by:
        applies in interface Restriction
        Parameters:
        versionString - candidate version string
        originalVersion - original version string
        Returns:
        true if given version passed the restriction test (version can be considered candidate for upgrading)
      • getPrefixString

        public String getPrefixString()