remove not required docs and .readthedocs.yaml
[msb/java-sdk.git] / src / main / java / org / onap / msb / sdk / httpclient / convert / jackson / JacksonConverterFactoryBuilder.java
1 /*******************************************************************************
2  * Copyright 2017 ZTE, Inc. and others.
3  * 
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
6  * 
7  * http://www.apache.org/licenses/LICENSE-2.0
8  * 
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
12  * the License.
13  ******************************************************************************/
14 package org.onap.msb.sdk.httpclient.convert.jackson;
15
16 import org.onap.msb.sdk.httpclient.convert.IConverterFactoryBuilder;
17
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;
22
23 import retrofit2.Converter.Factory;
24
25 /**
26  * @author hu.rui
27  *
28  */
29 public class JacksonConverterFactoryBuilder implements IConverterFactoryBuilder {
30
31   private static ObjectMapper objectMapper = new ObjectMapper();
32   static {
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);
36   }
37
38
39   /*
40    * (non-Javadoc)
41    * 
42    * @see
43    * com.zte.ums.zenap.httpclient.retrofit.convert.IConverterFactoryBuilder#buildConverterFactory()
44    */
45   @Override
46   public Factory buildConverterFactory() {
47     return JacksonConverterFactory.create(objectMapper);
48   }
49
50 }