static Object timestamp(Schema schema, Object value) { if (value instanceof Number) { Number number = (Number) value; return Timestamp.toLogical(schema, number.longValue()); } return value; }
static Object timestamp(Schema schema, Object value) { if (value instanceof Number) { Number number = (Number) value; return Timestamp.toLogical(schema, number.longValue()); } return value; }
@Override public Date toRaw(Config config, Object orig) { if (!(orig instanceof Long)) throw new DataException("Expected Unix timestamp to be a Long, but found " + orig.getClass()); return Timestamp.toLogical(Timestamp.SCHEMA, (Long) orig); }
@Override public Object convert(Schema schema, Object value) { if (!(value instanceof Long)) throw new DataException("Invalid type for Timestamp, underlying representation should be int64 but was " + value.getClass()); return Timestamp.toLogical(schema, (long) value); } });
if (isProtobufTimestamp(schema)) { com.google.protobuf.Timestamp timestamp = (com.google.protobuf.Timestamp) value; return Timestamp.toLogical(schema, Timestamps.toMillis(timestamp));