Package io.microsphere.classloading
Class MavenArtifact
- java.lang.Object
-
- io.microsphere.classloading.Artifact
-
- io.microsphere.classloading.MavenArtifact
-
@Immutable public class MavenArtifact extends Artifact
Represents a Maven software artifact with attributes such as group ID, artifact ID, version, and location. This class extends the basicArtifact
by adding Maven-specific identification through group ID. It supports matching artifacts based on group ID, in addition to the properties defined in the parent class.Example Usage
// Create a Maven artifact with group ID, artifact ID, and default version (UNKNOWN) MavenArtifact mavenArtifact1 = MavenArtifact.create("com.example", "my-artifact"); // Create a Maven artifact with group ID, artifact ID, and specific version MavenArtifact mavenArtifact2 = MavenArtifact.create("com.example", "my-artifact", "1.0.0"); // Create a Maven artifact with group ID, artifact ID, version, and location URL location = new URL("http://example.com/artifact.jar"); MavenArtifact mavenArtifact3 = MavenArtifact.create("com.example", "my-artifact", "1.0.0", location); // Matching Maven artifacts based on group ID, artifact ID, and version boolean isMatch = mavenArtifact1.matches(mavenArtifact2); // returns false
- Since:
- 1.0.0
- Author:
- Mercy
- See Also:
Artifact
,ArtifactResourceResolver
-
-
Constructor Summary
Constructors Constructor Description MavenArtifact(java.lang.String groupId, java.lang.String artifactId, java.lang.String version, java.net.URL location)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static MavenArtifact
create(java.lang.String groupId, java.lang.String artifactId)
static MavenArtifact
create(java.lang.String groupId, java.lang.String artifactId, java.lang.String version)
static MavenArtifact
create(java.lang.String groupId, java.lang.String artifactId, java.lang.String version, java.net.URL location)
boolean
equals(java.lang.Object o)
java.lang.String
getGroupId()
Get the group id of Maven Artifactint
hashCode()
boolean
matches(Artifact artifact)
java.lang.String
toString()
-
Methods inherited from class io.microsphere.classloading.Artifact
create, create, getArtifactId, getLocation, getVersion, matches, matchesArtifactId, matchesVersion
-
-
-
-
Method Detail
-
create
public static MavenArtifact create(@Nonnull java.lang.String groupId, @Nonnull java.lang.String artifactId, @Nullable java.lang.String version, @Nullable java.net.URL location)
-
create
public static MavenArtifact create(@Nonnull java.lang.String groupId, @Nonnull java.lang.String artifactId, @Nullable java.lang.String version)
-
create
public static MavenArtifact create(@Nonnull java.lang.String groupId, @Nonnull java.lang.String artifactId)
-
getGroupId
@Nonnull public java.lang.String getGroupId()
Get the group id of Maven Artifact- Returns:
- non-null
-
-