Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
/*
* Copyright (c) 2014 Spotify AB.
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package com.spotify.helios.common;
import com.google.common.base.Throwables;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.core.JsonParser;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.JavaType;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.MappingIterator;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.ObjectReader;
import com.fasterxml.jackson.databind.ObjectWriter;
import com.fasterxml.jackson.databind.type.TypeFactory;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.lang.reflect.Type;
import java.util.Map;
import static com.fasterxml.jackson.databind.DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES;
import static com.fasterxml.jackson.databind.MapperFeature.SORT_PROPERTIES_ALPHABETICALLY;
import static com.fasterxml.jackson.databind.SerializationFeature.ORDER_MAP_ENTRIES_BY_KEYS;
import static com.fasterxml.jackson.databind.SerializationFeature.WRITE_DATES_AS_TIMESTAMPS;
public class Json {
private static final ObjectMapper OBJECT_MAPPER = new ObjectMapper()
.configure(SORT_PROPERTIES_ALPHABETICALLY, true)
.configure(ORDER_MAP_ENTRIES_BY_KEYS, true)
.configure(WRITE_DATES_AS_TIMESTAMPS, false)
.configure(FAIL_ON_UNKNOWN_PROPERTIES, false);
private static final ObjectWriter NORMALIZING_OBJECT_WRITER = new ObjectMapper()
.setSerializationInclusion(JsonInclude.Include.NON_EMPTY)
.configure(SORT_PROPERTIES_ALPHABETICALLY, true)
.configure(ORDER_MAP_ENTRIES_BY_KEYS, true)
.configure(WRITE_DATES_AS_TIMESTAMPS, false)
.writer();
private static final ObjectWriter PRETTY_OBJECT_WRITER = new ObjectMapper()
.configure(SORT_PROPERTIES_ALPHABETICALLY, true)
.configure(ORDER_MAP_ENTRIES_BY_KEYS, true)
.configure(WRITE_DATES_AS_TIMESTAMPS, false)
.writerWithDefaultPrettyPrinter();
private static final TypeReference