Project

General

Profile

1
package eu.dnetlib.index.solr.browsing;
2

    
3
import javax.xml.bind.annotation.XmlAttribute;
4
import javax.xml.bind.annotation.XmlRootElement;
5

    
6
import org.springframework.beans.factory.annotation.Required;
7

    
8
/**
9
 * <pre>
10
 * {@code
11
 * <groupresult field="facetFieldName">
12
 * 	<value>facetFieldValue</value>
13
 * 	<count>1</count>
14
 * </groupresult>
15
 * }
16
 * </pre>
17
 *
18
 * @author claudio
19
 *
20
 */
21
@XmlRootElement(namespace = "", name = "groupresult")
22
public class GroupResult {
23

    
24
	private String name;
25

    
26
	private String value;
27

    
28
	private int count;
29

    
30
	public GroupResult() {}
31

    
32
	/**
33
	 * Builds a groupResult.
34
	 *
35
	 * @param fieldName
36
	 * @param fieldValue
37
	 * @param count
38
	 */
39
	public GroupResult(final String name, final String value, final int count) {
40
		this.name = name;
41
		this.value = value;
42
		this.count = count;
43
	}
44

    
45
	@Override
46
	public boolean equals(final Object obj) {
47
		if (!(obj instanceof GroupResult)) return false;
48
		final GroupResult g = (GroupResult) obj;
49
		if ((this.getCount() == g.getCount()) && this.getName().equals(g.getName()) && this.getValue().equals(g.getValue())) return true;
50
		return false;
51
	}
52

    
53
	@XmlAttribute(name = "field", required = true)
54
	public String getName() {
55
		return name;
56
	}
57

    
58
	public String getValue() {
59
		return value;
60
	}
61

    
62
	public int getCount() {
63
		return count;
64
	}
65

    
66
	@Required
67
	public void setName(final String name) {
68
		this.name = name;
69
	}
70

    
71
	@Required
72
	public void setValue(final String value) {
73
		this.value = value;
74
	}
75

    
76
	@Required
77
	public void setCount(final int count) {
78
		this.count = count;
79
	}
80

    
81
}
(2-2/2)