@Test public void testFromLogical() { assertEquals(0, Time.fromLogical(Time.SCHEMA, EPOCH.getTime())); assertEquals(10000, Time.fromLogical(Time.SCHEMA, EPOCH_PLUS_TEN_THOUSAND_MILLIS.getTime())); }
public static int fromLogical(Schema schema, java.util.Date value) { if (schema.name() == null || !(schema.name().equals(LOGICAL_NAME))) throw new DataException("Requested conversion of Time object but the schema does not match."); Calendar calendar = Calendar.getInstance(UTC); calendar.setTime(value); long unixMillis = calendar.getTimeInMillis(); if (unixMillis < 0 || unixMillis > MILLIS_PER_DAY) { throw new DataException("Kafka Connect Time type should not have any date fields set to non-zero values."); } return (int) unixMillis; }
Time { public static int fromLogical(Schema schema, java.util.Date value) { if (schema.name() == null || !(schema.name().equals(LOGICAL_NAME))) throw new DataException("Requested conversion of Time object but the schema does not match."); Calendar calendar = Calendar.getInstance(UTC); calendar.setTime(value); long unixMillis = calendar.getTimeInMillis(); if (unixMillis < 0 || unixMillis > MILLIS_PER_DAY) { throw new DataException("Kafka Connect Time type should not have any date fields set to non-zero values."); } return (int) unixMillis; } }
Time { public static int fromLogical(Schema schema, java.util.Date value) { if (schema.name() == null || !(schema.name().equals(LOGICAL_NAME))) throw new DataException("Requested conversion of Time object but the schema does not match."); Calendar calendar = Calendar.getInstance(UTC); calendar.setTime(value); long unixMillis = calendar.getTimeInMillis(); if (unixMillis < 0 || unixMillis > MILLIS_PER_DAY) { throw new DataException("Kafka Connect Time type should not have any date fields set to non-zero values."); } return (int) unixMillis; }  }
Time { public static int fromLogical(Schema schema, java.util.Date value) { if (schema.name() == null || !(schema.name().equals(LOGICAL_NAME))) throw new DataException("Requested conversion of Time object but the schema does not match."); Calendar calendar = Calendar.getInstance(UTC); calendar.setTime(value); long unixMillis = calendar.getTimeInMillis(); if (unixMillis < 0 || unixMillis > MILLIS_PER_DAY) { throw new DataException("Kafka Connect Time type should not have any date fields set to non-zero values."); } return (int) unixMillis; }  static SchemaBuilder builder(); static int fromLogical(Schema schema, java.util.Date value); static java.util.Date toLogical(Schema schema, int value); }
Time { public static int fromLogical(Schema schema, java.util.Date value) { if (schema.name() == null || !(schema.name().equals(LOGICAL_NAME))) throw new DataException("Requested conversion of Time object but the schema does not match."); Calendar calendar = Calendar.getInstance(UTC); calendar.setTime(value); long unixMillis = calendar.getTimeInMillis(); if (unixMillis < 0 || unixMillis > MILLIS_PER_DAY) { throw new DataException("Kafka Connect Time type should not have any date fields set to non-zero values."); } return (int) unixMillis; }  static SchemaBuilder builder(); static int fromLogical(Schema schema, java.util.Date value); static java.util.Date toLogical(Schema schema, int value); static final String LOGICAL_NAME; static final Schema SCHEMA; }