/** * Converts a value object for an expected JDBC type of {@link Types#INTEGER}. * * @param column the column definition describing the {@code data} value; never null * @param fieldDefn the field definition; never null * @param data the data object to be converted into a {@link Date Kafka Connect date} type; never null * @return the converted value, or null if the conversion could not be made and the column allows nulls * @throws IllegalArgumentException if the value could not be converted but the column does not allow nulls */ protected Object convertBigInt(Column column, Field fieldDefn, Object data) { return convertValue(column, fieldDefn, data, 0L, (r) -> { if (data instanceof Long) { r.deliver(data); } else if (data instanceof Number) { Number value = (Number) data; r.deliver(Long.valueOf(value.longValue())); } else if (data instanceof Boolean) { r.deliver(NumberConversions.getLong((Boolean) data)); } else if (data instanceof String) { r.deliver(Long.valueOf((String) data)); } }); }
/** * Converts a value object for an expected JDBC type of {@link Types#INTEGER}. * * @param column the column definition describing the {@code data} value; never null * @param fieldDefn the field definition; never null * @param data the data object to be converted into a {@link Date Kafka Connect date} type; never null * @return the converted value, or null if the conversion could not be made and the column allows nulls * @throws IllegalArgumentException if the value could not be converted but the column does not allow nulls */ protected Object convertBigInt(Column column, Field fieldDefn, Object data) { return convertValue(column, fieldDefn, data, 0L, (r) -> { if (data instanceof Long) { r.deliver(data); } else if (data instanceof Number) { Number value = (Number) data; r.deliver(Long.valueOf(value.longValue())); } else if (data instanceof Boolean) { r.deliver(NumberConversions.getLong((Boolean) data)); } else if (data instanceof String) { r.deliver(Long.parseLong((String) data)); } }); }