2 * Copyright © 2021 Orange, Inc. and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
8 package org.opendaylight.transportpce.dmaap.client.resource.config;
10 import com.fasterxml.jackson.databind.ObjectMapper;
11 import com.fasterxml.jackson.databind.SerializationFeature;
12 import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
13 import javax.ws.rs.ext.ContextResolver;
15 public class JsonConfigurator implements ContextResolver<ObjectMapper> {
17 private final ObjectMapper mapper;
19 public JsonConfigurator() {
20 mapper = new ObjectMapper();
21 mapper.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS);
22 mapper.disable(SerializationFeature.FAIL_ON_EMPTY_BEANS);
23 mapper.enable(SerializationFeature.INDENT_OUTPUT);
24 mapper.registerModule(new JavaTimeModule());
25 mapper.registerModule(new PublishNotificationServiceModule());
29 public ObjectMapper getContext(Class<?> type) {