1   
2   
3   
4   
5   
6   
7   
8   
9   
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  package org.apache.maven.model.building;
20  
21  import java.io.File;
22  import java.nio.file.Path;
23  import java.util.Objects;
24  
25  import org.apache.maven.building.FileSource;
26  
27  
28  
29  
30  
31  
32  
33  @Deprecated(since = "4.0.0")
34  public class ArtifactModelSource extends FileSource implements ModelSource {
35      private final String groupId;
36  
37      private final String artifactId;
38  
39      private final String version;
40  
41      private final int hashCode;
42  
43      @Deprecated
44      public ArtifactModelSource(File file, String groupId, String artifactId, String version) {
45          super(file);
46          this.groupId = groupId;
47          this.artifactId = artifactId;
48          this.version = version;
49          this.hashCode = Objects.hash(groupId, artifactId, version);
50      }
51  
52      public ArtifactModelSource(Path path, String groupId, String artifactId, String version) {
53          super(path);
54          this.groupId = groupId;
55          this.artifactId = artifactId;
56          this.version = version;
57          this.hashCode = Objects.hash(groupId, artifactId, version);
58      }
59  
60      public String getGroupId() {
61          return groupId;
62      }
63  
64      public String getArtifactId() {
65          return artifactId;
66      }
67  
68      public String getVersion() {
69          return version;
70      }
71  
72      @Override
73      public int hashCode() {
74          return hashCode;
75      }
76  
77      @Override
78      public boolean equals(Object obj) {
79          if (this == obj) {
80              return true;
81          }
82          if (obj == null) {
83              return false;
84          }
85  
86          if (!ArtifactModelSource.class.equals(obj.getClass())) {
87              return false;
88          }
89  
90          ArtifactModelSource other = (ArtifactModelSource) obj;
91          return Objects.equals(artifactId, other.artifactId)
92                  && Objects.equals(groupId, other.groupId)
93                  && Objects.equals(version, other.version);
94      }
95  
96      @Override
97      public String toString() {
98          return groupId + ":" + artifactId + ":" + version;
99      }
100 }