| Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
| NotNullExpression |
|
| 1.6666666666666667;1.667 | ||||
| NotNullExpression$Constants |
|
| 1.6666666666666667;1.667 |
| 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.XmlRootElement; | |
| 22 | import javax.xml.bind.annotation.XmlType; | |
| 23 | ||
| 24 | import org.apache.commons.lang.StringUtils; | |
| 25 | ||
| 26 | /** | |
| 27 | * An immutable expression which represents an "is not null" statement which is | |
| 28 | * evaluated the property defined by the property path on 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 = NotNullExpression.Constants.ROOT_ELEMENT_NAME) |
| 40 | @XmlAccessorType(XmlAccessType.NONE) | |
| 41 | @XmlType(name = NotNullExpression.Constants.TYPE_NAME) | |
| 42 | public final class NotNullExpression extends AbstractExpression implements PropertyPathExpression { | |
| 43 | ||
| 44 | private static final long serialVersionUID = 6723462533500402423L; | |
| 45 | @XmlAttribute(name = CriteriaSupportUtils.PropertyConstants.PROPERTY_PATH) | |
| 46 | private final String propertyPath; | |
| 47 | ||
| 48 | /** | |
| 49 | * Should only be invoked by JAXB. | |
| 50 | */ | |
| 51 | @SuppressWarnings("unused") | |
| 52 | 2 | private NotNullExpression() { |
| 53 | 2 | this.propertyPath = null; |
| 54 | 2 | } |
| 55 | ||
| 56 | /** | |
| 57 | * Constructs a NotNullExpression for the given propertyPath. | |
| 58 | * | |
| 59 | * @param propertyPath the property path for the expression, must not be null or blank | |
| 60 | * | |
| 61 | * @throws IllegalArgumentException if the propertyPath is null or blank | |
| 62 | */ | |
| 63 | 3 | NotNullExpression(String propertyPath) { |
| 64 | 3 | if (StringUtils.isBlank(propertyPath)) { |
| 65 | 2 | throw new IllegalArgumentException("Property path cannot be null or blank."); |
| 66 | } | |
| 67 | 1 | this.propertyPath = propertyPath; |
| 68 | 1 | } |
| 69 | ||
| 70 | @Override | |
| 71 | public String getPropertyPath() { | |
| 72 | 0 | return propertyPath; |
| 73 | } | |
| 74 | ||
| 75 | /** | |
| 76 | * Defines some internal constants used on this class. | |
| 77 | */ | |
| 78 | 0 | static class Constants { |
| 79 | final static String ROOT_ELEMENT_NAME = "notNull"; | |
| 80 | final static String TYPE_NAME = "NotNullType"; | |
| 81 | } | |
| 82 | ||
| 83 | } |