1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
|
11 | |
|
12 | |
|
13 | |
|
14 | |
|
15 | |
|
16 | |
package org.kuali.rice.core.api.criteria; |
17 | |
|
18 | |
import javax.xml.bind.annotation.XmlAccessType; |
19 | |
import javax.xml.bind.annotation.XmlAccessorType; |
20 | |
import javax.xml.bind.annotation.XmlRootElement; |
21 | |
import javax.xml.bind.annotation.XmlType; |
22 | |
import javax.xml.bind.annotation.XmlValue; |
23 | |
|
24 | |
import org.apache.commons.lang.builder.EqualsBuilder; |
25 | |
import org.apache.commons.lang.builder.HashCodeBuilder; |
26 | |
import org.apache.commons.lang.builder.ToStringBuilder; |
27 | |
|
28 | |
|
29 | |
|
30 | |
|
31 | |
|
32 | |
|
33 | |
|
34 | |
|
35 | 6 | @XmlRootElement(name = CriteriaStringValue.Constants.ROOT_ELEMENT_NAME) |
36 | |
@XmlAccessorType(XmlAccessType.NONE) |
37 | |
@XmlType(name = CriteriaStringValue.Constants.TYPE_NAME) |
38 | |
public final class CriteriaStringValue implements CriteriaValue<String> { |
39 | |
|
40 | |
@XmlValue |
41 | |
private final String value; |
42 | |
|
43 | 36 | CriteriaStringValue() { |
44 | 36 | this.value = null; |
45 | 36 | } |
46 | |
|
47 | 112 | CriteriaStringValue(CharSequence value) { |
48 | 112 | if (value == null) { |
49 | 0 | throw new IllegalArgumentException("Value cannot be null."); |
50 | |
} |
51 | 112 | this.value = value.toString(); |
52 | 112 | } |
53 | |
|
54 | |
@Override |
55 | |
public String getValue() { |
56 | 6 | return value; |
57 | |
} |
58 | |
|
59 | |
@Override |
60 | |
public int hashCode() { |
61 | 278 | return HashCodeBuilder.reflectionHashCode(this); |
62 | |
} |
63 | |
|
64 | |
@Override |
65 | |
public boolean equals(Object obj) { |
66 | 36 | return EqualsBuilder.reflectionEquals(obj, this); |
67 | |
} |
68 | |
|
69 | |
@Override |
70 | |
public String toString() { |
71 | 0 | return ToStringBuilder.reflectionToString(this); |
72 | |
} |
73 | |
|
74 | |
|
75 | |
|
76 | |
|
77 | 0 | static class Constants { |
78 | |
final static String ROOT_ELEMENT_NAME = "stringValue"; |
79 | |
final static String TYPE_NAME = "CriteriaStringValueType"; |
80 | |
} |
81 | |
|
82 | |
} |