1 package org.kuali.rice.krad.data.converters;
2
3 import javax.persistence.AttributeConverter;
4 import javax.persistence.Converter;
5
6 import org.kuali.rice.core.api.util.type.KualiInteger;
7
8
9
10
11 @Converter(
12 autoApply = true)
13 public class KualiIntegerConverter implements AttributeConverter<KualiInteger, Long> {
14
15 @Override
16 public Long convertToDatabaseColumn(KualiInteger objectValue) {
17 if (objectValue == null) {
18 return null;
19 }
20 return objectValue.longValue();
21 }
22
23 @Override
24 public KualiInteger convertToEntityAttribute(Long dataValue) {
25 if (dataValue == null) {
26 return null;
27 }
28 return new KualiInteger(dataValue);
29 }
30
31 }