1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package org.apache.maven.buildcache.checksum;
20
21 import java.nio.file.Path;
22
23
24
25
26 public class WalkKey {
27
28 private final Path normalized;
29 private final String glob;
30 private final boolean recursive;
31
32 public WalkKey(Path normalized, String glob, boolean recursive) {
33 this.normalized = normalized;
34 this.glob = glob;
35 this.recursive = recursive;
36 }
37
38 @Override
39 public boolean equals(Object o) {
40 if (this == o) {
41 return true;
42 }
43 if (o == null || getClass() != o.getClass()) {
44 return false;
45 }
46
47 WalkKey key = (WalkKey) o;
48
49 if (recursive != key.recursive) {
50 return false;
51 }
52 if (!normalized.equals(key.normalized)) {
53 return false;
54 }
55 return glob.equals(key.glob);
56 }
57
58 @Override
59 public int hashCode() {
60 int result = normalized.hashCode();
61 result = 31 * result + glob.hashCode();
62 result = 31 * result + (recursive ? 1 : 0);
63 return result;
64 }
65
66 public Path getPath() {
67 return normalized;
68 }
69
70 public String getGlob() {
71 return glob;
72 }
73
74 public boolean isRecursive() {
75 return recursive;
76 }
77
78 @Override
79 public String toString() {
80 return "WalkKey{" + "normalized=" + normalized + ", glob='" + glob + '\'' + ", recursive=" + recursive + '}';
81 }
82 }