Coverage Report - org.kuali.rice.core.api.criteria.CriteriaIntegerValue
 
Classes in this File Line Coverage Branch Coverage Complexity
CriteriaIntegerValue
61%
24/39
50%
1/2
1.154
CriteriaIntegerValue$Constants
0%
0/1
N/A
1.154
 
 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 java.math.BigInteger;
 19  
 import java.util.concurrent.atomic.AtomicInteger;
 20  
 import java.util.concurrent.atomic.AtomicLong;
 21  
 
 22  
 import javax.xml.bind.annotation.XmlAccessType;
 23  
 import javax.xml.bind.annotation.XmlAccessorType;
 24  
 import javax.xml.bind.annotation.XmlRootElement;
 25  
 import javax.xml.bind.annotation.XmlType;
 26  
 import javax.xml.bind.annotation.XmlValue;
 27  
 
 28  
 import org.apache.commons.lang.builder.EqualsBuilder;
 29  
 import org.apache.commons.lang.builder.HashCodeBuilder;
 30  
 import org.apache.commons.lang.builder.ToStringBuilder;
 31  
 import org.apache.commons.lang.mutable.MutableLong;
 32  
 
 33  
 /**
 34  
  * A CriteriaValue which stores date and time information in the form of a
 35  
  * {@link BigInteger} value.
 36  
  * 
 37  
  * @author Kuali Rice Team (rice.collab@kuali.org)
 38  
  *
 39  
  */
 40  2
 @XmlRootElement(name = CriteriaIntegerValue.Constants.ROOT_ELEMENT_NAME)
 41  
 @XmlAccessorType(XmlAccessType.NONE)
 42  
 @XmlType(name = CriteriaIntegerValue.Constants.TYPE_NAME)
 43  
 public final class CriteriaIntegerValue implements CriteriaValue<BigInteger> {
 44  
 
 45  
     @XmlValue
 46  
     private BigInteger value;
 47  
     
 48  34
     CriteriaIntegerValue() {
 49  34
         this.value = null;
 50  34
     }
 51  
     
 52  12
     CriteriaIntegerValue(BigInteger value) {
 53  12
             validateValue(value);
 54  12
         this.value = value;
 55  12
     }
 56  
     
 57  1
     CriteriaIntegerValue(Short value) {
 58  1
             validateValue(value);
 59  1
             this.value = BigInteger.valueOf(value.longValue());
 60  1
     }
 61  
         
 62  52
     CriteriaIntegerValue(Integer value) {
 63  52
             validateValue(value);
 64  52
             this.value = BigInteger.valueOf(value.longValue());
 65  52
     }
 66  
     
 67  0
     CriteriaIntegerValue(AtomicInteger value) {
 68  0
             validateValue(value);
 69  0
             this.value = BigInteger.valueOf(value.longValue());
 70  0
     }
 71  
     
 72  1
     CriteriaIntegerValue(Long value) {
 73  1
             validateValue(value);
 74  1
             this.value = BigInteger.valueOf(value.longValue());
 75  1
     }
 76  
     
 77  0
     CriteriaIntegerValue(AtomicLong value) {
 78  0
             validateValue(value);
 79  0
             this.value = BigInteger.valueOf(value.longValue());
 80  0
     }
 81  
     
 82  0
     CriteriaIntegerValue(MutableLong value) {
 83  0
             validateValue(value);
 84  0
             this.value = BigInteger.valueOf(value.longValue());
 85  0
     }
 86  
     
 87  
     private static void validateValue(Object value) {
 88  66
             if (value == null) {
 89  0
                     throw new IllegalArgumentException("Value cannot be null.");
 90  
             }
 91  66
     }
 92  
     
 93  
     @Override
 94  
     public BigInteger getValue() {
 95  2
         return value;
 96  
     }
 97  
     
 98  
     @Override
 99  
     public int hashCode() {
 100  0
         return HashCodeBuilder.reflectionHashCode(this);
 101  
     }
 102  
 
 103  
     @Override
 104  
     public boolean equals(Object obj) {
 105  34
         return EqualsBuilder.reflectionEquals(obj, this);
 106  
     }
 107  
 
 108  
     @Override
 109  
     public String toString() {
 110  0
         return ToStringBuilder.reflectionToString(this);
 111  
     }
 112  
     
 113  
     /**
 114  
      * Defines some internal constants used on this class.
 115  
      */
 116  0
     static class Constants {
 117  
         final static String ROOT_ELEMENT_NAME = "integerValue";
 118  
         final static String TYPE_NAME = "CriteriaIntegerValueType";
 119  
     }
 120  
     
 121  
 }