diff options
author | Charles Cole <cc847m@att.com> | 2017-10-09 14:50:36 -0500 |
---|---|---|
committer | Charles Cole <cc847m@att.com> | 2017-10-09 16:35:23 -0500 |
commit | 8cc9302953a918df0665c28722175b962e5b75fd (patch) | |
tree | 07a440eea88a34080d3a1fce41fcab5539bab685 | |
parent | 86b60d8d28e4891259094fa1e936c6e579620b29 (diff) |
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 <cc847m@att.com>
-rw-r--r-- | policy-management/src/main/java/org/onap/policy/drools/protocol/coders/ProtocolCoderToolset.java | 6 |
1 files changed, 4 insertions, 2 deletions
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 |