-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
/
UnknownField.java
60 lines (50 loc) · 1.32 KB
/
UnknownField.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
package org.jabref.model.entry.field;
import java.util.EnumSet;
import java.util.Locale;
import java.util.Objects;
import java.util.Set;
public class UnknownField implements Field {
private final String name;
private final Set<FieldProperty> properties;
public UnknownField(String name) {
this.name = name;
this.properties = EnumSet.noneOf(FieldProperty.class);
}
public UnknownField(String name, FieldProperty first, FieldProperty... rest) {
this.name = name;
this.properties = EnumSet.of(first, rest);
}
@Override
public Set<FieldProperty> getProperties() {
return properties;
}
@Override
public String getName() {
return name;
}
@Override
public boolean isStandardField() {
return false;
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (!(o instanceof Field)) {
return false;
}
Field other = (Field) o;
return name.equalsIgnoreCase(other.getName());
}
@Override
public int hashCode() {
return Objects.hash(name.toLowerCase(Locale.ENGLISH));
}
@Override
public String toString() {
return "UnknownField{" +
"name='" + name + '\'' +
'}';
}
}