package com.lidroid.xutils.db.converter;
import android.database.Cursor;
import android.text.TextUtils;
import com.lidroid.xutils.db.sqlite.ColumnDbType;
/**
* Author: wyouflf
* Date: 13-11-4
* Time: 下午10:51
*/
public class IntegerColumnConverter implements ColumnConverter<Integer> {
@Override
public Integer getFieldValue(final Cursor cursor, int index) {
return cursor.isNull(index) ? null : cursor.getInt(index);
}
@Override
public Integer getFieldValue(String fieldStringValue) {
if (TextUtils.isEmpty(fieldStringValue)) return null;
return Integer.valueOf(fieldStringValue);
}
@Override
public Object fieldValue2ColumnValue(Integer fieldValue) {
return fieldValue;
}
@Override
public ColumnDbType getColumnDbType() {
return ColumnDbType.INTEGER;
}
}