/** * Convert value via expected class type. * * @param value original value * @param convertType expected class type * @return converted value */ publicstatic Object convertValue(final Object value, final Class<?> convertType){ if (null == value) { return convertNullValue(convertType); } if (value.getClass() == convertType) { return value; } if (LocalDateTime.class.equals(convertType)) { return convertLocalDateTimeValue(value, convertType); } if (LocalDate.class.equals(convertType)) { return convertLocalDateValue(value, convertType); } if (LocalTime.class.equals(convertType)) { return convertLocalTimeValue(value, convertType); }
if (value instanceof Number) { return convertNumberValue(value, convertType); } if (value instanceof Date) { return convertDateValue(value, convertType); } if (value instanceofbyte[]) { return convertByteArrayValue(value, convertType); } if (String.class.equals(convertType)) { return value.toString(); } else { return value; } }
@Override public <T> T getObject(finalint columnIndex, final Class<T> type)throws SQLException { thrownew SQLFeatureNotSupportedException("getObject with type"); }
@Override public <T> T getObject(final String columnLabel, final Class<T> type)throws SQLException { thrownew SQLFeatureNotSupportedException("getObject with type"); }