diff options
author | James Ahlborn <jtahlborn@yahoo.com> | 2015-01-16 04:30:32 +0000 |
---|---|---|
committer | James Ahlborn <jtahlborn@yahoo.com> | 2015-01-16 04:30:32 +0000 |
commit | 03490053350b104516bc09a5301f7c02afc5000c (patch) | |
tree | a8be60f7e6856c7e2437a5c7404fb6274e548538 /src/main/java | |
parent | 6b74a49d9b03abc9d9d8c347c6e2297266f4a378 (diff) | |
download | jackcess-03490053350b104516bc09a5301f7c02afc5000c.tar.gz jackcess-03490053350b104516bc09a5301f7c02afc5000c.zip |
minor cleanup in toInternalValue
git-svn-id: https://svn.code.sf.net/p/jackcess/code/jackcess/trunk@909 f203690c-595d-4dc9-a70b-905162fa7fd2
Diffstat (limited to 'src/main/java')
-rw-r--r-- | src/main/java/com/healthmarketscience/jackcess/impl/ColumnImpl.java | 76 |
1 files changed, 38 insertions, 38 deletions
diff --git a/src/main/java/com/healthmarketscience/jackcess/impl/ColumnImpl.java b/src/main/java/com/healthmarketscience/jackcess/impl/ColumnImpl.java index e244d31..2b05b83 100644 --- a/src/main/java/com/healthmarketscience/jackcess/impl/ColumnImpl.java +++ b/src/main/java/com/healthmarketscience/jackcess/impl/ColumnImpl.java @@ -1712,46 +1712,46 @@ public class ColumnImpl implements Column, Comparable<ColumnImpl> { public static Object toInternalValue(DataType dataType, Object value) throws IOException { - if(value != null) { - switch(dataType) { - case BOOLEAN: - return ((value instanceof Boolean) ? value : toBooleanValue(value)); - case BYTE: - return ((value instanceof Byte) ? value : toNumber(value).byteValue()); - case INT: - return ((value instanceof Short) ? value : - toNumber(value).shortValue()); - case LONG: - return ((value instanceof Integer) ? value : - toNumber(value).intValue()); - case MONEY: - return toBigDecimal(value); - case FLOAT: - return ((value instanceof Float) ? value : - toNumber(value).floatValue()); - case DOUBLE: - return ((value instanceof Double) ? value : - toNumber(value).doubleValue()); - case SHORT_DATE_TIME: - return ((value instanceof DateExt) ? value : - new Date(toDateLong(value))); - case TEXT: - case MEMO: - case GUID: - return ((value instanceof String) ? value : - toCharSequence(value).toString()); - case NUMERIC: - return toBigDecimal(value); - case COMPLEX_TYPE: - // leave alone for now? - break; - default: - // some variation of binary data - return toByteArray(value); - } + if(value == null) { + return null; } - return value; + switch(dataType) { + case BOOLEAN: + return ((value instanceof Boolean) ? value : toBooleanValue(value)); + case BYTE: + return ((value instanceof Byte) ? value : toNumber(value).byteValue()); + case INT: + return ((value instanceof Short) ? value : + toNumber(value).shortValue()); + case LONG: + return ((value instanceof Integer) ? value : + toNumber(value).intValue()); + case MONEY: + return toBigDecimal(value); + case FLOAT: + return ((value instanceof Float) ? value : + toNumber(value).floatValue()); + case DOUBLE: + return ((value instanceof Double) ? value : + toNumber(value).doubleValue()); + case SHORT_DATE_TIME: + return ((value instanceof DateExt) ? value : + new Date(toDateLong(value))); + case TEXT: + case MEMO: + case GUID: + return ((value instanceof String) ? value : + toCharSequence(value).toString()); + case NUMERIC: + return toBigDecimal(value); + case COMPLEX_TYPE: + // leave alone for now? + return value; + default: + // some variation of binary data + return toByteArray(value); + } } /** |