Class LocationPattern


  • public class LocationPattern
    extends Object

    Helper class to compare Maven URIs (and falling back to other URIs) that may use globs and version ranges.

    Each Maven URI may contain these components: groupId, artifactId, optional version, optional type and optional classifier. Concrete URIs do not use globs and use precise versions (we do not consider LATEST and RELEASE Maven versions here).

    When comparing two Maven URIs, we split them to components and may use RegExps and VersionRanges

    When pattern URI doesn't use mvn: scheme, plain String.equals(Object) is used or Matcher.matches() when pattern uses * glob.

    • Field Detail

      • LOG

        public static org.slf4j.Logger LOG
    • Method Detail

      • getOriginalUri

        public String getOriginalUri()
      • getGroupId

        public String getGroupId()
      • getArtifactId

        public String getArtifactId()
      • getVersionString

        public String getVersionString()
      • toRegExp

        public static Pattern toRegExp​(String value)
        Converts a String with one special character (*) into working Pattern
        Parameters:
        value -
        Returns:
      • matches

        public boolean matches​(String otherUri)
        Returns true if this location pattern matches other pattern.
        Parameters:
        otherUri -
        Returns:
      • strictlyMatches

        public boolean strictlyMatches​(String otherUri)
        Returns true if this location pattern strictly matches other pattern.

        In a strict match, if this instance doesn't contain a classifier, it won't match against an otherUri which contains one.