Coverage Report - org.kuali.rice.core.framework.persistence.ojb.conversion.OjbKualiIntegerFieldConversion
 
Classes in this File Line Coverage Branch Coverage Complexity
OjbKualiIntegerFieldConversion
0%
0/11
0%
0/6
2.5
 
 1  
 /*
 2  
  * Copyright 2006-2008 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.framework.persistence.ojb.conversion;
 17  
 
 18  
 import org.apache.ojb.broker.accesslayer.conversions.FieldConversion;
 19  
 import org.kuali.rice.core.api.util.type.KualiInteger;
 20  
 
 21  
 import java.math.BigInteger;
 22  
 
 23  0
 public class OjbKualiIntegerFieldConversion implements FieldConversion {
 24  
 
 25  
     /**
 26  
      * @see FieldConversion#javaToSql(Object)
 27  
      */
 28  
     public Object javaToSql(Object source) {
 29  0
         Object converted = source;
 30  
 
 31  0
         if (source instanceof KualiInteger) {
 32  0
             converted = new Long(((KualiInteger) source).longValue());
 33  
         }
 34  
 
 35  0
         return converted;
 36  
     }
 37  
 
 38  
     /**
 39  
      * @see FieldConversion#sqlToJava(Object)
 40  
      */
 41  
     public Object sqlToJava(Object source) {
 42  0
         Object converted = source;
 43  
 
 44  0
         if (source instanceof Long) {
 45  0
             converted = new KualiInteger(((Long) source).longValue());
 46  
         }
 47  0
         else if (source instanceof BigInteger) {
 48  0
             converted = new KualiInteger((BigInteger) source);
 49  
         }
 50  
 
 51  0
         return converted;
 52  
     }
 53  
 }