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.util.Objects;
23
24 import org.apache.maven.building.FileSource;
25
26
27
28
29
30
31
32 public class ArtifactModelSource extends FileSource implements ModelSource {
33 private final String groupId;
34
35 private final String artifactId;
36
37 private final String version;
38
39 private final int hashCode;
40
41 public ArtifactModelSource(File file, String groupId, String artifactId, String version) {
42 super(file);
43 this.groupId = groupId;
44 this.artifactId = artifactId;
45 this.version = version;
46 this.hashCode = Objects.hash(groupId, artifactId, version);
47 }
48
49 public String getGroupId() {
50 return groupId;
51 }
52
53 public String getArtifactId() {
54 return artifactId;
55 }
56
57 public String getVersion() {
58 return version;
59 }
60
61 @Override
62 public int hashCode() {
63 return hashCode;
64 }
65
66 @Override
67 public boolean equals(Object obj) {
68 if (this == obj) {
69 return true;
70 }
71 if (obj == null) {
72 return false;
73 }
74
75 if (!ArtifactModelSource.class.equals(obj.getClass())) {
76 return false;
77 }
78
79 ArtifactModelSource other = (ArtifactModelSource) obj;
80 return Objects.equals(artifactId, other.artifactId)
81 && Objects.equals(groupId, other.groupId)
82 && Objects.equals(version, other.version);
83 }
84 }