@Override public Object parseDefaultString(FieldType fieldType, String defaultStr) throws SQLException { try { return Long.parseLong(defaultStr); } catch (NumberFormatException e) { throw SqlExceptionUtil.create( "Problems with field " + fieldType + " parsing default DateTime value: " + defaultStr, e); } }
private Object createInstance(Long sqlArg) throws SQLException { try { if (millisConstructor == null) { Class<?> clazz = getDateTimeClass(); millisConstructor = clazz.getConstructor(long.class); } return millisConstructor.newInstance(sqlArg); } catch (Exception e) { throw SqlExceptionUtil.create("Could not use reflection to construct a Joda DateTime", e); } }
private Long extractMillis(Object javaObject) throws SQLException { try { if (getMillisMethod == null) { Class<?> clazz = getDateTimeClass(); getMillisMethod = clazz.getMethod("getMillis"); } if (javaObject == null) { return null; } else { return (Long) getMillisMethod.invoke(javaObject); } } catch (Exception e) { throw SqlExceptionUtil.create( "Could not use reflection to get millis from Joda DateTime: " + javaObject, e); } }