Package org.apache.karaf.features
Class LocationPattern
- java.lang.Object
-
- org.apache.karaf.features.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
andRELEASE
Maven versions here).When comparing two Maven URIs, we split them to components and may use RegExps and
VersionRange
sWhen pattern URI doesn't use
mvn:
scheme, plainString.equals(Object)
is used orMatcher.matches()
when pattern uses*
glob.
-
-
Field Summary
Fields Modifier and Type Field Description static org.slf4j.Logger
LOG
-
Constructor Summary
Constructors Constructor Description LocationPattern(String uri)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description String
getArtifactId()
String
getGroupId()
String
getOriginalUri()
String
getVersionString()
boolean
matches(String otherUri)
Returnstrue
if this location pattern matches other pattern.boolean
strictlyMatches(String otherUri)
Returnstrue
if this location pattern strictly matches other pattern.static Pattern
toRegExp(String value)
Converts a String with one special character (*
) into workingPattern
String
toString()
-
-
-
Constructor Detail
-
LocationPattern
public LocationPattern(String uri) throws IllegalArgumentException
- Throws:
IllegalArgumentException
-
-
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 workingPattern
- Parameters:
value
-- Returns:
-
matches
public boolean matches(String otherUri)
Returnstrue
if this location pattern matches other pattern.- Parameters:
otherUri
-- Returns:
-
strictlyMatches
public boolean strictlyMatches(String otherUri)
Returnstrue
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.
-
-