-
Notifications
You must be signed in to change notification settings - Fork 5
/
TagAnnotation.java
62 lines (49 loc) · 1.63 KB
/
TagAnnotation.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
57
58
59
60
61
62
package org.genericsystem.api.core;
import java.io.Serializable;
import java.lang.annotation.Annotation;
import java.util.Arrays;
import java.util.Objects;
import java.util.stream.Collectors;
public class TagAnnotation implements Serializable {
private static final long serialVersionUID = -2849507333202498923L;
private Class<? extends Annotation> annotationClass;
private Class<?>[] path;
private int[] pos;
private String name;
public TagAnnotation(Class<? extends Annotation> annotationClass, Class<?>[] path, int[] pos) {
this(annotationClass, path, pos, null);
}
public TagAnnotation(Class<? extends Annotation> annotationClass, Class<?>[] path, int[] pos, String name) {
this.annotationClass = annotationClass;
this.path = path;
this.pos = pos;
this.name = name;
}
public Class<? extends Annotation> getAnnotationClass() {
return annotationClass;
}
public Class<?>[] getPath() {
return path;
}
public int[] getPos() {
return pos;
}
public String getName() {
return name;
}
@Override
public int hashCode() {
return annotationClass.hashCode();
}
@Override
public boolean equals(Object obj) {
if (!(obj instanceof TagAnnotation))
return false;
TagAnnotation other = (TagAnnotation) obj;
return annotationClass.equals(other.annotationClass) && Objects.equals(name, other.name) && Objects.deepEquals(path, other.path) && Objects.deepEquals(pos, other.pos);
}
@Override
public String toString() {
return "{ annotationClass: " + annotationClass.getSimpleName() + ", path: " + Arrays.toString(path) + ", pos: " + Arrays.stream(pos).boxed().collect(Collectors.toList()) + ", name: " + name + "}";
}
}