Class ArtifactCoordsPattern
groupId,
artifactId,
classifier, type and version).
To create a new ArtifactCoordsPattern, use either of(String) or builder(), both of which accept
wildcard patterns (rather than regular expression patterns). See the JavaDocs of the two respective methods for more
details.
ArtifactCoordsPattern overrides hashCode() and equals(Object) and can thus be used as a key in a
Map.
-
Nested Class Summary
Nested Classes -
Method Summary
Modifier and TypeMethodDescriptionbuilder()booleaninthashCode()static ArtifactCoordsPatternmatchAll()booleanmatches(ArtifactCoords coords) Matches the givengroupId,artifactId,type,classifier,versionquintuple against thisArtifactCoordsPattern.booleanMatches the givengroupId,artifactId,type,classifier,versionquintuple against thisArtifactCoordsPattern.static ArtifactCoordsPatternstatic ArtifactCoordsPatternof(ArtifactCoords c) static ArtifactCoordsPatternCreates a newArtifactCoordsPatternout of the givenwildcardPattern.static List<ArtifactCoordsPattern> toPatterns(Collection<ArtifactCoords> coords) toString()
-
Method Details
-
builder
- Returns:
- a new
ArtifactCoordsPattern.Builder
-
of
-
toPatterns
-
matchAll
- Returns:
- a singleton that matches all possible GAVs
-
matchSnapshots
- Returns:
- a singleton that matches any GAV that has a version ending with "-SNAPSHOT"
-
of
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 ':'.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
-
equals
-
hashCode
public int hashCode() -
matches
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
-
toString
-