Commit e2e2c782674398f88c8c835c71f9913d1d5d834e

Authored by Luis Pedro
1 parent cfe0b96559
Exists in master and in 1 other branch API_v3.0

C5077

src/main/java/org/um/dsi/gavea/orcid/client/jackson/JacksonConfigurator.java
@@ -0,0 +1,34 @@ @@ -0,0 +1,34 @@
  1 +/**
  2 + * Universidade do Minho
  3 + * Departamento de Sistemas de Informação
  4 + * Grupo Gávea
  5 + */
  6 +package org.um.dsi.gavea.orcid.client.jackson;
  7 +
  8 +import javax.ws.rs.ext.ContextResolver;
  9 +import javax.ws.rs.ext.Provider;
  10 +
  11 +import com.fasterxml.jackson.databind.DeserializationFeature;
  12 +import com.fasterxml.jackson.databind.ObjectMapper;
  13 +
  14 +/**
  15 +* @author Luís Pedro
  16 +*
  17 +* Created: 10 Oct 2018 - 15:27:59
  18 +*/
  19 +@Provider
  20 +public class JacksonConfigurator implements ContextResolver<ObjectMapper> {
  21 +
  22 + private final ObjectMapper mapper;
  23 +
  24 + public JacksonConfigurator() {
  25 + mapper = new ObjectMapper();
  26 + mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
  27 + }
  28 +
  29 + @Override
  30 + public ObjectMapper getContext(Class<?> type) {
  31 + return mapper;
  32 + }
  33 +
  34 +}