diff options
author | Pamela Dragosh <pdragosh@research.att.com> | 2021-02-18 09:57:23 -0600 |
---|---|---|
committer | Pamela Dragosh <pdragosh@research.att.com> | 2021-02-18 10:31:55 -0600 |
commit | 00ee2d5b4f1e847d8e272c79f66230aa30cb11d6 (patch) | |
tree | 0244e22a68626e1f2175ec8d7f5c4491f8712948 /gson/src/main/java/org/onap/policy/common/gson/GsonMessageBodyHandler.java | |
parent | 564ef19e77b5f8b47fe54822939e806162b7b5fb (diff) |
Add more java.time adapters
The time extensions require these adapters for anyone using our
gson adapter to serialize/deserialize the DecisionRequest.
Issue-ID: POLICY-2810
Change-Id: I64a7e4a5a256c77bd67dab867664e41b61cd0050
Signed-off-by: Pamela Dragosh <pdragosh@research.att.com>
Diffstat (limited to 'gson/src/main/java/org/onap/policy/common/gson/GsonMessageBodyHandler.java')
-rw-r--r-- | gson/src/main/java/org/onap/policy/common/gson/GsonMessageBodyHandler.java | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/gson/src/main/java/org/onap/policy/common/gson/GsonMessageBodyHandler.java b/gson/src/main/java/org/onap/policy/common/gson/GsonMessageBodyHandler.java index d6e36b39..df3def3c 100644 --- a/gson/src/main/java/org/onap/policy/common/gson/GsonMessageBodyHandler.java +++ b/gson/src/main/java/org/onap/policy/common/gson/GsonMessageBodyHandler.java @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * ONAP * ================================================================================ - * Copyright (C) 2019-2020 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2019-2021 AT&T Intellectual Property. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -31,7 +31,11 @@ import java.lang.annotation.Annotation; import java.lang.reflect.Type; import java.nio.charset.StandardCharsets; import java.time.Instant; +import java.time.LocalDate; import java.time.LocalDateTime; +import java.time.OffsetDateTime; +import java.time.OffsetTime; +import java.time.ZoneOffset; import java.time.ZonedDateTime; import javax.ws.rs.Consumes; import javax.ws.rs.Produces; @@ -91,7 +95,11 @@ public class GsonMessageBodyHandler implements MessageBodyReader<Object>, Messag return builder.disableHtmlEscaping().registerTypeAdapterFactory(new MapDoubleAdapterFactory()) .registerTypeAdapter(Instant.class, new InstantTypeAdapter()) .registerTypeAdapter(LocalDateTime.class, new LocalDateTimeTypeAdapter()) - .registerTypeAdapter(ZonedDateTime.class, new ZonedDateTimeTypeAdapter()); + .registerTypeAdapter(ZonedDateTime.class, new ZonedDateTimeTypeAdapter()) + .registerTypeAdapter(OffsetDateTime.class, new OffsetDateTimeTypeAdapter()) + .registerTypeAdapter(OffsetTime.class, new OffsetTimeTypeAdapter()) + .registerTypeAdapter(LocalDate.class, new LocalDateTypeAdapter()) + .registerTypeAdapter(ZoneOffset.class, new ZoneOffsetTypeAdapter()); } @Override |