From 8cc9302953a918df0665c28722175b962e5b75fd Mon Sep 17 00:00:00 2001 From: Charles Cole Date: Mon, 9 Oct 2017 14:50:36 -0500 Subject: Register a gson type adapter for Instant Added a type adapter to the encoder used without a custom encoder so that it properly serializes Instant types. Issue-ID: POLICY-101 Change-Id: Ic1517505d50b81abc840a1591c7fb4a75f80a126 Signed-off-by: Charles Cole --- .../onap/policy/drools/protocol/coders/ProtocolCoderToolset.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'policy-management/src/main/java') diff --git a/policy-management/src/main/java/org/onap/policy/drools/protocol/coders/ProtocolCoderToolset.java b/policy-management/src/main/java/org/onap/policy/drools/protocol/coders/ProtocolCoderToolset.java index d53ab28e..07206f95 100644 --- a/policy-management/src/main/java/org/onap/policy/drools/protocol/coders/ProtocolCoderToolset.java +++ b/policy-management/src/main/java/org/onap/policy/drools/protocol/coders/ProtocolCoderToolset.java @@ -533,14 +533,16 @@ class GsonProtocolCoderToolset extends ProtocolCoderToolset { */ @JsonIgnore protected final Gson decoder = new GsonBuilder().disableHtmlEscaping() - .registerTypeAdapter(ZonedDateTime.class, new GsonUTCAdapter()).create(); + .registerTypeAdapter(ZonedDateTime.class, new GsonUTCAdapter()) + .registerTypeAdapter(Instant.class, new GsonInstantAdapter()).create(); /** * encoder */ @JsonIgnore protected final Gson encoder = new GsonBuilder().disableHtmlEscaping() - .registerTypeAdapter(ZonedDateTime.class, new GsonUTCAdapter()).create(); + .registerTypeAdapter(ZonedDateTime.class, new GsonUTCAdapter()) + .registerTypeAdapter(Instant.class, new GsonInstantAdapter()).create(); /** * Toolset to encode/decode tools associated with a topic -- cgit 1.2.3-korg