Class ArtifactCoordsPattern
- java.lang.Object
-
- io.quarkus.maven.dependency.ArtifactCoordsPattern
-
public class ArtifactCoordsPattern extends Object
A general purpose pattern for matching artifact coordinates (i.e. quintupless consisting ofgroupId,artifactId,classifier,typeandversion).To create a new
ArtifactCoordsPattern, use eitherof(String)orbuilder(), both of which accept wildcard patterns (rather than regular expression patterns). See the JavaDocs of the two respective methods for more details.ArtifactCoordsPatternoverrideshashCode()andequals(Object)and can thus be used as a key in aMap.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classArtifactCoordsPattern.BuilderAArtifactCoordsPatternbuilder.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static ArtifactCoordsPattern.Builderbuilder()booleanequals(Object obj)inthashCode()static ArtifactCoordsPatternmatchAll()booleanmatches(ArtifactCoords coords)Matches the givengroupId,artifactId,type,classifier,versionquintuple against thisArtifactCoordsPattern.booleanmatches(String groupId, String artifactId, String classifier, String type, String version)Matches the givengroupId,artifactId,type,classifier,versionquintuple against thisArtifactCoordsPattern.static ArtifactCoordsPatternmatchSnapshots()static ArtifactCoordsPatternof(ArtifactCoords c)static ArtifactCoordsPatternof(String wildcardPattern)Creates a newArtifactCoordsPatternout of the givenwildcardPattern.static List<ArtifactCoordsPattern>toPatterns(Collection<ArtifactCoords> coords)StringtoString()
-
-
-
Method Detail
-
builder
public static ArtifactCoordsPattern.Builder builder()
- Returns:
- a new
ArtifactCoordsPattern.Builder
-
of
public static ArtifactCoordsPattern of(ArtifactCoords c)
-
toPatterns
public static List<ArtifactCoordsPattern> toPatterns(Collection<ArtifactCoords> coords)
-
matchAll
public static ArtifactCoordsPattern matchAll()
- Returns:
- a singleton that matches all possible GAVs
-
matchSnapshots
public static ArtifactCoordsPattern matchSnapshots()
- Returns:
- a singleton that matches any GAV that has a version ending with "-SNAPSHOT"
-
of
public static ArtifactCoordsPattern of(String wildcardPattern)
Creates a newArtifactCoordsPatternout of the givenwildcardPattern. A wildcard pattern consists of string literals and asterisk wildcard*.*matches zero or many arbitrary characters. Wildcard patterns for groupId, artifactId, classifier, type and version need to be delimited by colon 58.The general syntax of a
ArtifactCoordsPatternfollows the patterngroupIdPattern:[artifactIdPattern:[[classifierIdPattern:typePattern]:versionPattern]]. Note that classifier and type need to be specified both or none and that they may occur on the third and fourth position respectively. Hence aArtifactCoordsPatternwith three segmentsorg.my-group:my-artifact:1.2.3is a short hand fororg.my-group:my-artifact:*:*:1.2.3matching any type and any classifier.ArtifactCoordsPatternpattern examples:org.my-group- an equivalent oforg.my-group:*:*:*. It will match any version of any artifact having groupIdorg.my-group.org.my-group*- an equivalent oforg.my-group*:*:*:*. It will match any version of any artifact whose groupId starts withorg.my-group- i.e. it will match all oforg.my-group,org.my-group.api,org.my-group.impl, etc.org.my-group:my-artifact- an equivalent oforg.my-group:my-artifact:*. It will match any version of all such artifacts that have groupIdorg.my-groupand artifactIdmy-artifactorg.my-group:my-artifact:1.2.3- will match just the version 1.2.3 of artifactsorg.my-group:my-artifact.org.my-group:my-artifact:linux-x86_64:*:1.2.3- will match artifacts of all types having classifier linux-x86_64 and version 1.2.3 oforg.my-group:my-artifact.org.my-group:my-artifact::*:1.2.3- will match artifacts of all types having no classifier and version 1.2.3 oforg.my-group:my-artifact.org.my-group:my-artifact:jar:1.2.3- Illegal because both type and classifier have to be specified.org.my-group:my-artifact::jar:1.2.3- will match the jar having no classifier and version 1.2.3 oforg.my-group:my-artifact.- Parameters:
wildcardPattern- a string pattern to parse and create a newArtifactCoordsPatternfrom- Returns:
- a new
ArtifactCoordsPattern
-
matches
public boolean matches(ArtifactCoords coords)
Matches the givengroupId,artifactId,type,classifier,versionquintuple against thisArtifactCoordsPattern.- Parameters:
coords- artifact coordinates- Returns:
trueif thisArtifactCoordsPatternmatches the given coordinates, otherwise - false
-
matches
public boolean matches(String groupId, String artifactId, String classifier, String type, String version)
Matches the givengroupId,artifactId,type,classifier,versionquintuple against thisArtifactCoordsPattern.- Parameters:
groupId- groupIdartifactId- artifactIdclassifier- can benulltype- cannot benullversion- version- Returns:
trueif thisArtifactCoordsPatternmatches the givengroupId,artifactId,type,classifier,versionquintuple andfalse otherwise
-
-