code: public DateTime toDateTime(T dateTime) {
      try {
        @SuppressWarnings("unchecked") // Expected class.
        D dateObj = (D) PropertyUtils.getProperty(dateTime, "date");
        String timeZoneId =
            PropertyUtils.isReadable(dateTime, "timeZoneId")
                ? (String) PropertyUtils.getProperty(dateTime, "timeZoneId")
                : (String) PropertyUtils.getProperty(dateTime, "timeZoneID");
        return new DateTime(
            (Integer) PropertyUtils.getProperty(dateObj, "year"),
            (Integer) PropertyUtils.getProperty(dateObj, "month"),
            (Integer) PropertyUtils.getProperty(dateObj, "day"),
            (Integer) PropertyUtils.getProperty(dateTime, "hour"),
            (Integer) PropertyUtils.getProperty(dateTime, "minute"),
            (Integer) PropertyUtils.getProperty(dateTime, "second"),
            0,
            DateTimeZone.forTimeZone(TimeZone.getTimeZone(timeZoneId)));
      } catch (IllegalAccessException e) {
        throw new IllegalStateException("Could not access class.", e);
      } catch (InvocationTargetException e) {
        throw new IllegalStateException("Could not get field.", e);
      } catch (NoSuchMethodException e) {
        throw new IllegalStateException("Could not get field.", e);
      }
    }
docs: Converts an API date time to a {@code DateTime} preserving the time zone.