/*
 * Copyright (c) 2013, Inversoft 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 org.primeframework.mvc.content.guice;

import com.fasterxml.jackson.annotation.JsonInclude.Include;
import com.fasterxml.jackson.databind.MapperFeature;
import com.fasterxml.jackson.databind.Module;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
import com.google.inject.Inject;
import com.google.inject.Provider;

import java.util.Set;

/**
 * Guice provider for the Jackson {@link ObjectMapper}.
 *
 * @author Brian Pontarelli
 */
public class ObjectMapperProvider implements Provider<ObjectMapper> {
  private final Set<Module> jacksonModules;

  @Inject
  public ObjectMapperProvider(Set<Module> jacksonModules) {
    this.jacksonModules = jacksonModules;
  }

  @Override
  public ObjectMapper get() {
    ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL)
                                                  .configure(MapperFeature.SORT_PROPERTIES_ALPHABETICALLY, true)
                                                  .configure(SerializationFeature.FAIL_ON_EMPTY_BEANS, false)
                                                  .configure(SerializationFeature.ORDER_MAP_ENTRIES_BY_KEYS, true)
                                                  .configure(SerializationFeature.WRITE_EMPTY_JSON_ARRAYS, false)
                                                  .configure(SerializationFeature.WRITE_NULL_MAP_VALUES, false);
    if (jacksonModules.size() > 0) {
      objectMapper.registerModules(jacksonModules);
    }

    return objectMapper;
  }
}

@@ -17,16 +17,21 @@
 (c) 2013
+-2017
 , Invers
@@ -678,59 +678,200 @@
 ort 
-com.fasterxml.jackson.annotation.JsonInclude.Includ
+java.util.Set;%0A%0Aimport org.primeframework.mvc.config.MVCConfiguration;%0A%0Aimport com.fasterxml.jackson.annotation.JsonInclude.Include;%0Aimport com.fasterxml.jackson.databind.DeserializationFeatur
 e;%0Ai
@@ -1149,39 +1149,16 @@
 vider;%0A%0A
-import java.util.Set;%0A%0A
 /**%0A * G
@@ -1314,16 +1314,65 @@
 pper%3E %7B%0A
+  private final boolean allowUnknownParameters;%0A%0A
   privat
@@ -1474,16 +1474,51 @@
 nModules
+, MVCConfiguration mvcConfiguration
 ) %7B%0A    
@@ -1555,16 +1555,93 @@
 odules;%0A
+    this.allowUnknownParameters = mvcConfiguration.allowUnknownParameters();%0A
   %7D%0A%0A  @
@@ -2104,32 +2104,169 @@
 _BY_KEYS, true)%0A
+                                                  .configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, !allowUnknownParameters)%0A
                 

Set FAIL_ON_UNKNOWN_PROPERTIES based upon MVC Configuration for allowUnknownParameters