1
|
package eu.dnetlib.utils;
|
2
|
|
3
|
import com.google.common.collect.ComparisonChain;
|
4
|
|
5
|
/**
|
6
|
* Container class for metadata format, layout and interpretation.
|
7
|
*
|
8
|
* @author claudio
|
9
|
*/
|
10
|
public class MetadataReference {
|
11
|
|
12
|
/**
|
13
|
* Metadata format.
|
14
|
*/
|
15
|
private String format;
|
16
|
|
17
|
/**
|
18
|
* Metadata layout.
|
19
|
*/
|
20
|
private String layout;
|
21
|
|
22
|
/**
|
23
|
* Metadata interpretation.
|
24
|
*/
|
25
|
private String interpretation;
|
26
|
|
27
|
/**
|
28
|
* Constructor for MetadataReference.
|
29
|
*
|
30
|
* @param format Metadata format
|
31
|
* @param layout Metadata layout
|
32
|
* @param interpretation Metadata interpretation
|
33
|
*/
|
34
|
public MetadataReference(final String format, final String layout, final String interpretation) {
|
35
|
this.format = format;
|
36
|
this.layout = layout;
|
37
|
this.interpretation = interpretation;
|
38
|
}
|
39
|
|
40
|
public String getFormat() {
|
41
|
return format;
|
42
|
}
|
43
|
|
44
|
public String getLayout() {
|
45
|
return layout;
|
46
|
}
|
47
|
|
48
|
public String getInterpretation() {
|
49
|
return interpretation;
|
50
|
}
|
51
|
|
52
|
@Override
|
53
|
public boolean equals(final Object that) {
|
54
|
|
55
|
if (!(that instanceof MetadataReference))
|
56
|
return false;
|
57
|
|
58
|
final MetadataReference mdRef = (MetadataReference) that;
|
59
|
|
60
|
return ComparisonChain.start()
|
61
|
.compare(this.format, mdRef.getFormat())
|
62
|
.compare(this.layout, mdRef.getLayout())
|
63
|
.compare(this.interpretation, mdRef.getInterpretation())
|
64
|
.result() == 0;
|
65
|
}
|
66
|
|
67
|
@Override
|
68
|
public int hashCode() {
|
69
|
return getFormat().hashCode() + getLayout().hashCode() + getInterpretation().hashCode();
|
70
|
}
|
71
|
|
72
|
@Override
|
73
|
public String toString() {
|
74
|
return getFormat() + "-" + getLayout() + "-" + getInterpretation();
|
75
|
}
|
76
|
|
77
|
}
|