/
TaskKey.java
56 lines (44 loc) · 1.11 KB
/
TaskKey.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
package git.lfs.migrate;
import org.eclipse.jgit.lib.ObjectId;
import org.jetbrains.annotations.NotNull;
/**
* Key of converter task.
*
* @author Artem V. Navrotskiy <bozaro@users.noreply.github.com>
*/
public final class TaskKey {
@NotNull
private final GitConverter.TaskType type;
@NotNull
private final ObjectId objectId;
public TaskKey(@NotNull GitConverter.TaskType type, @NotNull ObjectId objectId) {
this.type = type;
this.objectId = objectId.copy();
}
@NotNull
public GitConverter.TaskType getType() {
return type;
}
@NotNull
public ObjectId getObjectId() {
return objectId;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
TaskKey taskKey = (TaskKey) o;
return (type == taskKey.type)
&& objectId.equals(taskKey.objectId);
}
@Override
public int hashCode() {
int result = type.hashCode();
result = 31 * result + objectId.hashCode();
return result;
}
@Override
public String toString() {
return type + ":" + objectId.name();
}
}