Coverage Report - org.kuali.rice.core.api.criteria.CriteriaStringValue
 
Classes in this File Line Coverage Branch Coverage Complexity
CriteriaStringValue
84%
11/13
50%
1/2
1.333
CriteriaStringValue$Constants
0%
0/1
N/A
1.333
 
 1  
 /**
 2  
  * Copyright 2005-2011 The Kuali Foundation
 3  
  *
 4  
  * Licensed under the Educational Community License, Version 2.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/ecl2.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.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  
  * A CriteriaValue which stores date and time information in the form of a
 30  
  * {@link String} value.
 31  
  * 
 32  
  * @author Kuali Rice Team (rice.collab@kuali.org)
 33  
  *
 34  
  */
 35  7
 @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  111
     CriteriaStringValue(CharSequence value) {
 48  111
             if (value == null) {
 49  0
                     throw new IllegalArgumentException("Value cannot be null.");
 50  
             }
 51  111
             this.value = value.toString();
 52  111
     }
 53  
     
 54  
     @Override
 55  
     public String getValue() {
 56  7
         return value;
 57  
     }
 58  
     
 59  
     @Override
 60  
     public int hashCode() {
 61  168
         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  
      * Defines some internal constants used on this class.
 76  
      */
 77  0
     static class Constants {
 78  
         final static String ROOT_ELEMENT_NAME = "stringValue";
 79  
         final static String TYPE_NAME = "CriteriaStringValueType";
 80  
     }
 81  
     
 82  
 }