Coverage Report - org.kuali.rice.core.api.util.ConcreteKeyValue
 
Classes in this File Line Coverage Branch Coverage Complexity
ConcreteKeyValue
0%
0/19
0%
0/2
1.2
 
 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.util;
 17  
 
 18  
 import org.apache.commons.lang.builder.CompareToBuilder;
 19  
 import org.apache.commons.lang.builder.EqualsBuilder;
 20  
 import org.apache.commons.lang.builder.HashCodeBuilder;
 21  
 import org.apache.commons.lang.builder.ToStringBuilder;
 22  
 
 23  
 import java.util.Map;
 24  
 
 25  
 /**
 26  
  * A mutable, comparable key value pair of Strings.
 27  
  *  
 28  
  * This class is not meant to be extended.
 29  
  * 
 30  
  * For extension see AbstractKeyValue & KeyValue.
 31  
  * 
 32  
  * @author Kuali Rice Team (rice.collab@kuali.org)
 33  
  */
 34  0
 public final class ConcreteKeyValue extends AbstractKeyValue implements Comparable<KeyValue> {
 35  
         private static final long serialVersionUID = 1176799455504861488L;
 36  
 
 37  
         public ConcreteKeyValue() {
 38  0
                 super();
 39  0
         }
 40  
 
 41  
         public ConcreteKeyValue(String key, String value) {
 42  0
                 super(key, value);
 43  0
         }
 44  
 
 45  
         public ConcreteKeyValue(KeyValue keyValue) {
 46  0
                 super(keyValue);
 47  0
         }
 48  
         
 49  
         public ConcreteKeyValue(Map.Entry<String, String> entry) {
 50  0
                 super(entry);
 51  0
         }
 52  
         
 53  
         public void setKey(String key) {
 54  0
                 this.key = key;
 55  0
         }
 56  
 
 57  
         public void setValue(String value) {
 58  0
                 this.value = value;
 59  0
         }
 60  
 
 61  
         @Override
 62  
         public int compareTo(KeyValue o) {
 63  0
                 if (o == null) {
 64  0
                         throw new NullPointerException("o is null");
 65  
                 }
 66  
 
 67  0
                 return new CompareToBuilder()
 68  
                         .append(this.getValue(), o.getValue(), String.CASE_INSENSITIVE_ORDER)
 69  
                         .append(this.getKey(), o.getKey(), String.CASE_INSENSITIVE_ORDER)
 70  
                         .toComparison();
 71  
         }
 72  
 
 73  
     @Override
 74  
     public int hashCode() {
 75  0
         return HashCodeBuilder.reflectionHashCode(this);
 76  
     }
 77  
 
 78  
     @Override
 79  
     public boolean equals(Object obj) {
 80  0
         return EqualsBuilder.reflectionEquals(obj, this);
 81  
     }
 82  
 
 83  
     @Override
 84  
     public String toString() {
 85  0
         return ToStringBuilder.reflectionToString(this);
 86  
     }
 87  
 }