Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
GreaterThanOrEqualExpression |
|
| 1.0;1 | ||||
GreaterThanOrEqualExpression$Constants |
|
| 1.0;1 |
1 | /* | |
2 | * Copyright 2011 The Kuali Foundation | |
3 | * | |
4 | * Licensed under the Educational Community License, Version 1.0 (the "License"); | |
5 | * you may not use this file except in compliance with the License. | |
6 | * You may obtain a copy of the License at | |
7 | * | |
8 | * http://www.opensource.org/licenses/ecl1.php | |
9 | * | |
10 | * Unless required by applicable law or agreed to in writing, software | |
11 | * distributed under the License is distributed on an "AS IS" BASIS, | |
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
13 | * See the License for the specific language governing permissions and | |
14 | * limitations under the License. | |
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.XmlAttribute; | |
21 | import javax.xml.bind.annotation.XmlElement; | |
22 | import javax.xml.bind.annotation.XmlElements; | |
23 | import javax.xml.bind.annotation.XmlRootElement; | |
24 | import javax.xml.bind.annotation.XmlType; | |
25 | ||
26 | /** | |
27 | * An immutable expression which represents a "greater than or equal to" statement which is | |
28 | * evaluated the {@link CriteriaValue} of this expression. | |
29 | * | |
30 | * <p>Constructed as part of a {@link Criteria} when built using a | |
31 | * {@link CriteriaBuilder}. | |
32 | * | |
33 | * @see Criteria | |
34 | * @see CriteriaBuilder | |
35 | * | |
36 | * @author Kuali Rice Team (rice.collab@kuali.org) | |
37 | * | |
38 | */ | |
39 | 2 | @XmlRootElement(name = GreaterThanOrEqualExpression.Constants.ROOT_ELEMENT_NAME) |
40 | @XmlAccessorType(XmlAccessType.NONE) | |
41 | @XmlType(name = GreaterThanOrEqualExpression.Constants.TYPE_NAME) | |
42 | public final class GreaterThanOrEqualExpression extends AbstractExpression implements ValuedExpression { | |
43 | ||
44 | private static final long serialVersionUID = 2576163857285296720L; | |
45 | ||
46 | @XmlAttribute(name = CriteriaSupportUtils.PropertyConstants.PROPERTY_PATH) | |
47 | private final String propertyPath; | |
48 | @XmlElements(value = { | |
49 | @XmlElement(name = CriteriaDecimalValue.Constants.ROOT_ELEMENT_NAME, type = CriteriaDecimalValue.class, required = true), | |
50 | @XmlElement(name = CriteriaIntegerValue.Constants.ROOT_ELEMENT_NAME, type = CriteriaIntegerValue.class, required = true), | |
51 | @XmlElement(name = CriteriaDateTimeValue.Constants.ROOT_ELEMENT_NAME, type = CriteriaDateTimeValue.class, required = true) | |
52 | }) | |
53 | private final CriteriaValue<?> value; | |
54 | ||
55 | /** | |
56 | * Should only be invoked by JAXB. | |
57 | */ | |
58 | @SuppressWarnings("unused") | |
59 | 2 | private GreaterThanOrEqualExpression() { |
60 | 2 | this.propertyPath = null; |
61 | 2 | this.value = null; |
62 | 2 | } |
63 | ||
64 | /** | |
65 | * Constructs a GreaterThanOrEqualExpression for the given path and value. GreaterThanOrEqualExpression supports the following {@link CriteriaValue}: | |
66 | * | |
67 | * <ul> | |
68 | * <li>{@link CriteriaDateTimeValue}</li> | |
69 | * <li>{@link CriteriaDecimalValue}</li> | |
70 | * <li>{@link CriteriaIntegerValue}</li> | |
71 | * </ul> | |
72 | * | |
73 | * @param propertyPath the property path for the expression, must not be null or blank | |
74 | * @param value the value to evaluation the path against, must not be null. | |
75 | * | |
76 | * @throws IllegalArgumentException if the propertyPath is null or blank | |
77 | * @throws IllegalArgumentException if the value is null | |
78 | * @throws IllegalArgumentException if this expression does not support the given type of {@link CriteriaValue} | |
79 | */ | |
80 | 2 | GreaterThanOrEqualExpression(String propertyPath, CriteriaValue<?> value) { |
81 | 2 | CriteriaSupportUtils.validateValuedExpressionConstruction(getClass(), propertyPath, value); |
82 | 1 | this.propertyPath = propertyPath; |
83 | 1 | this.value = value; |
84 | 1 | } |
85 | ||
86 | @Override | |
87 | public String getPropertyPath() { | |
88 | 0 | return propertyPath; |
89 | } | |
90 | ||
91 | @Override | |
92 | public CriteriaValue<?> getValue() { | |
93 | 0 | return value; |
94 | } | |
95 | ||
96 | /** | |
97 | * Defines some internal constants used on this class. | |
98 | */ | |
99 | 0 | static class Constants { |
100 | final static String ROOT_ELEMENT_NAME = "greaterThanOrEqual"; | |
101 | final static String TYPE_NAME = "GreaterThanOrEqualType"; | |
102 | } | |
103 | ||
104 | } |