/* * Copyright © 2021 Orange, Inc. and others. All rights reserved. * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License v1.0 which accompanies this distribution, * and is available at http://www.eclipse.org/legal/epl-v10.html */ package org.opendaylight.transportpce.dmaap.client.resource.config; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule; import javax.ws.rs.ext.ContextResolver; public class JsonConfigurator implements ContextResolver { private final ObjectMapper mapper; public JsonConfigurator() { mapper = new ObjectMapper(); mapper.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS); mapper.disable(SerializationFeature.FAIL_ON_EMPTY_BEANS); mapper.enable(SerializationFeature.INDENT_OUTPUT); mapper.registerModule(new JavaTimeModule()); mapper.registerModule(new PublishNotificationServiceModule()); } @Override public ObjectMapper getContext(Class type) { return mapper; } }