Пример #1
0
 @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);
   }
 }
Пример #2
0
 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);
   }
 }
Пример #3
0
 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);
   }
 }