1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
|
11 | |
|
12 | |
|
13 | |
|
14 | |
|
15 | |
|
16 | |
package org.kuali.rice.core.util; |
17 | |
|
18 | |
import org.apache.commons.lang.builder.CompareToBuilder; |
19 | |
import org.apache.commons.lang.builder.EqualsBuilder; |
20 | |
import org.apache.commons.lang.builder.HashCodeBuilder; |
21 | |
import org.apache.commons.lang.builder.ToStringBuilder; |
22 | |
|
23 | |
import java.util.Map; |
24 | |
|
25 | |
|
26 | |
|
27 | |
|
28 | |
|
29 | |
|
30 | |
|
31 | |
|
32 | |
|
33 | |
|
34 | 0 | public final class ConcreteKeyValue extends AbstractKeyValue implements Comparable<KeyValue> { |
35 | |
private static final long serialVersionUID = 1176799455504861488L; |
36 | |
|
37 | |
public ConcreteKeyValue() { |
38 | 0 | super(); |
39 | 0 | } |
40 | |
|
41 | |
public ConcreteKeyValue(String key, String value) { |
42 | 0 | super(key, value); |
43 | 0 | } |
44 | |
|
45 | |
public ConcreteKeyValue(KeyValue keyValue) { |
46 | 0 | super(keyValue); |
47 | 0 | } |
48 | |
|
49 | |
public ConcreteKeyValue(Map.Entry<String, String> entry) { |
50 | 0 | super(entry); |
51 | 0 | } |
52 | |
|
53 | |
public void setKey(String key) { |
54 | 0 | this.key = key; |
55 | 0 | } |
56 | |
|
57 | |
public void setValue(String value) { |
58 | 0 | this.value = value; |
59 | 0 | } |
60 | |
|
61 | |
@Override |
62 | |
public int compareTo(KeyValue o) { |
63 | 0 | if (o == null) { |
64 | 0 | throw new NullPointerException("o is null"); |
65 | |
} |
66 | |
|
67 | 0 | return new CompareToBuilder() |
68 | |
.append(this.getValue(), o.getValue(), String.CASE_INSENSITIVE_ORDER) |
69 | |
.append(this.getKey(), o.getKey(), String.CASE_INSENSITIVE_ORDER) |
70 | |
.toComparison(); |
71 | |
} |
72 | |
|
73 | |
@Override |
74 | |
public int hashCode() { |
75 | 0 | return HashCodeBuilder.reflectionHashCode(this); |
76 | |
} |
77 | |
|
78 | |
@Override |
79 | |
public boolean equals(Object obj) { |
80 | 0 | return EqualsBuilder.reflectionEquals(obj, this); |
81 | |
} |
82 | |
|
83 | |
@Override |
84 | |
public String toString() { |
85 | 0 | return ToStringBuilder.reflectionToString(this); |
86 | |
} |
87 | |
} |