1
|
package eu.dnetlib.data.mapreduce.hbase.propagation;
|
2
|
|
3
|
import com.google.gson.Gson;
|
4
|
import eu.dnetlib.data.mapreduce.hbase.propagation.PropagationConstants.Type;
|
5
|
|
6
|
public class Value {
|
7
|
|
8
|
public static final String DEFAULT_TRUST = "0";
|
9
|
private Type type;
|
10
|
private String value;
|
11
|
private String trust;
|
12
|
|
13
|
public Value(String value) {
|
14
|
this(value, DEFAULT_TRUST);
|
15
|
}
|
16
|
|
17
|
public Value(String value, Type type) {
|
18
|
this.value = value;
|
19
|
this.type=type;
|
20
|
}
|
21
|
|
22
|
public Value(String value, String trust, Type type) {
|
23
|
|
24
|
this.value=value;
|
25
|
this.trust=trust;
|
26
|
this.type=type;
|
27
|
}
|
28
|
|
29
|
public static Value newInstance(String value, String trust) {
|
30
|
return new Value(value, trust);
|
31
|
}
|
32
|
|
33
|
public static Value newInstance(String value) {
|
34
|
return new Value(value);
|
35
|
}
|
36
|
|
37
|
public static Value newInstance(String value,Type type) {
|
38
|
return new Value(value,type);
|
39
|
}
|
40
|
|
41
|
public static Value newInstance(String value, String trust, Type type){
|
42
|
return new Value(value,trust,type);
|
43
|
}
|
44
|
|
45
|
public static Value fromJson(final String json) {
|
46
|
return new Gson().fromJson(json, Value.class);
|
47
|
}
|
48
|
|
49
|
public Value(String value, String trust) {
|
50
|
this.value = value;
|
51
|
this.trust = trust;
|
52
|
}
|
53
|
|
54
|
public String getValue() {
|
55
|
return value;
|
56
|
}
|
57
|
|
58
|
public Value setValue(String value) {
|
59
|
this.value = value;
|
60
|
return this;
|
61
|
}
|
62
|
|
63
|
public String getTrust() {
|
64
|
return trust;
|
65
|
}
|
66
|
|
67
|
public Value setTrust(String trust) {
|
68
|
this.trust = trust;
|
69
|
return this;
|
70
|
}
|
71
|
|
72
|
public String toJson() {
|
73
|
return new Gson().toJson(this);
|
74
|
}
|
75
|
|
76
|
|
77
|
public Type getType() {
|
78
|
return type;
|
79
|
}
|
80
|
|
81
|
public Value setType(Type type) {
|
82
|
this.type = type;
|
83
|
return this;
|
84
|
}
|
85
|
}
|