Support using java.time.Instant for event client
@@ -28,8 +28,10 @@ import java.io.IOException;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.net.InetAddress;
+import java.time.Instant;
import java.util.Map;
+import static java.time.format.DateTimeFormatter.ISO_INSTANT;
import static java.util.Objects.requireNonNull;
@SuppressWarnings("UnusedDeclaration")
@@ -145,6 +147,16 @@ enum EventDataType
}
},
+ INSTANT(Instant.class)
+ {
+ public void writeFieldValue(JsonGenerator jsonGenerator, Object value)
+ throws IOException
+ {
+ validateFieldValueType(value, Instant.class);
+ jsonGenerator.writeString(ISO_INSTANT.format((Instant) value));
+ }
+ },
+
DATETIME(DateTime.class)
{
@Override
