1 /*******************************************************************************
2 * Copyright 2017 ZTE, Inc. and others.
4 * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
5 * in compliance with the License. You may obtain a copy of the License at
7 * http://www.apache.org/licenses/LICENSE-2.0
9 * Unless required by applicable law or agreed to in writing, software distributed under the License
10 * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
11 * or implied. See the License for the specific language governing permissions and limitations under
13 ******************************************************************************/
14 package org.onap.msb.sdk.httpclient.convert.jackson;
16 import org.onap.msb.sdk.httpclient.convert.IConverterFactoryBuilder;
18 import com.fasterxml.jackson.annotation.JsonInclude;
19 import com.fasterxml.jackson.databind.DeserializationFeature;
20 import com.fasterxml.jackson.databind.ObjectMapper;
21 import com.fasterxml.jackson.databind.SerializationFeature;
23 import retrofit2.Converter.Factory;
29 public class JacksonConverterFactoryBuilder implements IConverterFactoryBuilder {
31 private static ObjectMapper objectMapper = new ObjectMapper();
33 objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
34 objectMapper.configure(SerializationFeature.FAIL_ON_EMPTY_BEANS, false);
35 objectMapper.setSerializationInclusion(JsonInclude.Include.NON_NULL);
43 * com.zte.ums.zenap.httpclient.retrofit.convert.IConverterFactoryBuilder#buildConverterFactory()
46 public Factory buildConverterFactory() {
47 return JacksonConverterFactory.create(objectMapper);