private T getValue()

in src/main/java/software/aws/neptune/jdbc/ResultSet.java [304:330]


    private <T> T getValue(final int columnIndex, final Class<T> targetType) throws SQLException {
        Object o = getConvertedValue(columnIndex);
        if (o == null) {
            return null;
        }
        if (o instanceof LocalTime) {
            o = getCalendarTime(Time.valueOf((LocalTime) o), DEFAULT_CALENDAR);
        } else if (o instanceof LocalDate) {
            o = getCalendarDate(Date.valueOf((LocalDate) o), DEFAULT_CALENDAR);
        } else if (o instanceof LocalDateTime) {
            o = getCalendarTimestamp(Timestamp.valueOf((LocalDateTime) o), DEFAULT_CALENDAR);
        } else if (o instanceof ZonedDateTime) {
            o = getCalendarTimestamp(Timestamp.valueOf(((ZonedDateTime) o).toLocalDateTime()), DEFAULT_CALENDAR);
        } else if (o instanceof OffsetTime) {
            o = getCalendarTime(Time.valueOf(((OffsetTime) o).toLocalTime()), DEFAULT_CALENDAR);
        }

        try {
            return JavaToJdbcTypeConverter.get(o.getClass(), targetType).convert(targetType, o);
        } catch (final ConversionException e) {
            throw SqlError.createSQLException(LOGGER,
                    SqlState.DATA_EXCEPTION,
                    SqlError.UNSUPPORTED_CONVERSION,
                    o.getClass().getSimpleName(),
                    targetType.getSimpleName());
        }
    }