/*
 * Copyright 2016 Palantir Technologies, Inc. All rights reserved.
 *
 * Licensed 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.palantir.remoting2.ext.jackson;

import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
import com.fasterxml.jackson.datatype.guava.GuavaModule;
import com.fasterxml.jackson.datatype.jdk8.Jdk8Module;
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
import com.fasterxml.jackson.module.afterburner.AfterburnerModule;

public final class ObjectMappers {

    private ObjectMappers() {}

    /**
     * Returns result of {@link #newClientObjectMapper()}. This method maintains source and binary
     * compatibility with previous releases of the 2.x branch.
     *
     * @deprecated use {@link #newClientObjectMapper()} instead.
     */
    @Deprecated
    public static ObjectMapper guavaJdk7Jdk8() {
        return newClientObjectMapper();
    }

    /**
     * Returns a default ObjectMapper with settings adjusted for use in servers.
     * <p>
     * Settings:
     * <ul>
     *   <li>Ignore unknown properties found during deserialization.
     * </ul>
     */
    public static ObjectMapper newClientObjectMapper() {
        return withDefaultModules(new ObjectMapper())
                .disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES);
    }

    /**
     * Returns a default ObjectMapper with settings adjusted for use in servers.
     * <p>
     * Settings:
     * <ul>
     *   <li>Throw on unknown properties found during deserialization.
     * </ul>
     */
    public static ObjectMapper newServerObjectMapper() {
        return withDefaultModules(new ObjectMapper())
                .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES);
    }

    /**
     * Configures provided ObjectMapper with default modules and settings.
     * <p>
     * Modules: Guava, JDK7, JDK8, Afterburner, JavaTime
     * <p>
     * Settings:
     * <ul>
     *   <li>Dates written as ISO-8601 strings.
     *   <li>Dates remain in received timezone.
     *   <li>Exceptions will not be wrapped with Jackson exceptions.
     *   <li>Deserializing a null for a primitive field will throw an exception.
     * </ul>
     */
    public static ObjectMapper withDefaultModules(ObjectMapper mapper) {
        return mapper
                .registerModule(new GuavaModule())
                .registerModule(new ShimJdk7Module())
                .registerModule(new Jdk8Module().configureAbsentsAsNulls(true))
                .registerModule(new AfterburnerModule())
                .registerModule(new JavaTimeModule())
                .disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS)
                .disable(DeserializationFeature.ADJUST_DATES_TO_CONTEXT_TIME_ZONE)
                .disable(DeserializationFeature.WRAP_EXCEPTIONS)
                .enable(DeserializationFeature.FAIL_ON_NULL_FOR_PRIMITIVES);
    }
}

@@ -1588,38 +1588,38 @@
 sted for use in 
-server
+client
 s.%0A     * %3Cp%3E%0A  

Fix ObjectMappers.java javadoc (#387)