| Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
| LikeExpression | 
  | 
  | 1.0;1 | ||||
| LikeExpression$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 "like" statement which is | |
| 28 |   * evaluated the {@link CriteriaValue} of this expression.  The criteria | |
| 29 |   * value for a like expression should support wildcards using "*". | |
| 30 |   *  | |
| 31 |   * <p>Constructed as part of a {@link Criteria} when built using a | |
| 32 |   * {@link CriteriaBuilder}. | |
| 33 |   *  | |
| 34 |   * @see Criteria | |
| 35 |   * @see CriteriaBuilder | |
| 36 |   *  | |
| 37 |   * @author Kuali Rice Team (rice.collab@kuali.org) | |
| 38 |   * | |
| 39 |   */ | |
| 40 | 10 | @XmlRootElement(name = LikeExpression.Constants.ROOT_ELEMENT_NAME)  | 
| 41 | @XmlAccessorType(XmlAccessType.NONE)  | |
| 42 | @XmlType(name = LikeExpression.Constants.TYPE_NAME)  | |
| 43 | public final class LikeExpression extends AbstractExpression implements ValuedExpression {  | |
| 44 | ||
| 45 | private static final long serialVersionUID = 6406122080039813800L;  | |
| 46 | ||
| 47 | @XmlAttribute(name = CriteriaSupportUtils.PropertyConstants.PROPERTY_PATH)  | |
| 48 | private final String propertyPath;  | |
| 49 |          @XmlElements(value = { | |
| 50 | @XmlElement(name = CriteriaStringValue.Constants.ROOT_ELEMENT_NAME, type = CriteriaStringValue.class, required = true)  | |
| 51 | })  | |
| 52 | private final CriteriaValue<?> value;  | |
| 53 | ||
| 54 |      /** | |
| 55 |       * Should only be invoked by JAXB. | |
| 56 |       */ | |
| 57 |      @SuppressWarnings("unused") | |
| 58 | 10 |      private LikeExpression() { | 
| 59 | 10 | this.propertyPath = null;  | 
| 60 | 10 | this.value = null;  | 
| 61 | 10 | }  | 
| 62 | ||
| 63 |      /** | |
| 64 |           * Constructs a LikeExpression for the given path and value.  LikeExpression supports only the | |
| 65 |           * {@link CriteriaStringValue}. | |
| 66 |           *  | |
| 67 |           * @param propertyPath the property path for the expression, must not be null or blank | |
| 68 |           * @param value the value to evaluation the path against, must not be null. | |
| 69 |           *  | |
| 70 |           * @throws IllegalArgumentException if the propertyPath is null or blank | |
| 71 |           * @throws IllegalArgumentException if the value is null | |
| 72 |           * @throws IllegalArgumentException if this expression does not support the given type of {@link CriteriaValue} | |
| 73 |           */ | |
| 74 | 17 |      LikeExpression(String propertyPath, CriteriaValue<?> value) { | 
| 75 | 17 | CriteriaSupportUtils.validateValuedExpressionConstruction(getClass(), propertyPath, value);  | 
| 76 | 12 |                  this.propertyPath = propertyPath; | 
| 77 | 12 |                  this.value = value; | 
| 78 | 12 | }  | 
| 79 | ||
| 80 | @Override  | |
| 81 |      public String getPropertyPath() { | |
| 82 | 2 |              return propertyPath; | 
| 83 | }  | |
| 84 | ||
| 85 | @Override  | |
| 86 |          public CriteriaValue<?> getValue() { | |
| 87 | 2 |                  return value; | 
| 88 | }  | |
| 89 | ||
| 90 |          /** | |
| 91 |       * Defines some internal constants used on this class. | |
| 92 |       */ | |
| 93 | 0 |      static class Constants { | 
| 94 | final static String ROOT_ELEMENT_NAME = "like";  | |
| 95 | final static String TYPE_NAME = "LikeType";  | |
| 96 | }  | |
| 97 | ||
| 98 | }  |