List of usage examples for com.fasterxml.jackson.databind ObjectMapper registerModule
public ObjectMapper registerModule(Module module)
From source file:com.hellblazer.slp.jmx.JmxDiscoveryConfiguration.java
public static JmxDiscoveryConfiguration fromYaml(InputStream yaml) throws JsonParseException, JsonMappingException, IOException { ObjectMapper objectMapper = new ObjectMapper(new YAMLFactory()); objectMapper.registerModule(new DiscoveryModule()); return objectMapper.readValue(yaml, JmxDiscoveryConfiguration.class); }
From source file:com.hellblazer.glassHouse.discovery.HubConfiguration.java
public static HubConfiguration fromYaml(InputStream yaml) throws JsonParseException, JsonMappingException, IOException { ObjectMapper mapper = new ObjectMapper(new YAMLFactory()); mapper.registerModule(new DiscoveryModule()); return mapper.readValue(yaml, HubConfiguration.class); }
From source file:com.chiralBehaviors.slp.hive.configuration.BroadcastConfiguration.java
public static BroadcastConfiguration fromYaml(InputStream yaml) throws JsonParseException, JsonMappingException, IOException { ObjectMapper mapper = new ObjectMapper(new YAMLFactory()); mapper.registerModule(new EngineModule()); return mapper.readValue(yaml, BroadcastConfiguration.class); }
From source file:io.github.retz.web.feign.Retz.java
static Retz connect(URI uri, Authenticator authenticator, SSLSocketFactory socketFactory, HostnameVerifier hostnameVerifier) { String url = Objects.requireNonNull(uri, "uri cannot be null").toString(); ObjectMapper mapper = new ObjectMapper(); mapper.registerModule(new Jdk8Module()); return Feign.builder().client(new Client.Default(socketFactory, hostnameVerifier)).logger(new Slf4jLogger()) .encoder(new JacksonEncoder(mapper)).decoder(new JacksonDecoder(mapper)) .errorDecoder(new ErrorResponseDecoder(mapper)) .requestInterceptor(new AuthHeaderInterceptor(authenticator)).target(Retz.class, url); }
From source file:io.yields.math.framework.kpi.ScoreDAO.java
private static ObjectMapper getObjectMapper() { ObjectMapper mapper = new ObjectMapper(); mapper.registerModule(new JSR310Module()); return mapper; }
From source file:org.springframework.data.custom.RestTest.java
public static ObjectMapper mapper() { final HalHandlerInstantiator instantiator = new HalHandlerInstantiator(new DefaultRelProvider(), null, null);//from w w w .j a v a2 s . c o m final ObjectMapper m = new ObjectMapper(); m.registerModule(new Jackson2HalModule()); m.registerModule(new SimpleModule() { { setMixInAnnotation(Link.class, LinkReadMixin.class); } }); m.setHandlerInstantiator(instantiator); m.enable(SerializationFeature.INDENT_OUTPUT); return m; }
From source file:com.groupon.jackson.ObjectMapperFactory.java
private static ObjectMapper createModifiableObjectMapper(final String name, final ObjectMapper objectMapper) { final SimpleModule module = new SimpleModule(name); objectMapper.registerModule(module); objectMapper.registerModule(new GuavaModule()); objectMapper.registerModule(new Jdk7Module()); objectMapper.registerModule(new Jdk8Module()); objectMapper.registerModule(new JodaModule()); objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); objectMapper.configure(DeserializationFeature.WRAP_EXCEPTIONS, false); objectMapper.configure(SerializationFeature.FAIL_ON_EMPTY_BEANS, false); objectMapper.configure(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS, false); objectMapper.setDateFormat(new ISO8601DateFormat()); return objectMapper; }
From source file:com.chiralbehaviors.CoRE.kernel.KernelUtil.java
private static RehydratedWorkspace readKernel(InputStream is) throws IOException, JsonParseException, JsonMappingException { ObjectMapper mapper = new ObjectMapper(); mapper.registerModule(new CoREModule()); RehydratedWorkspace workspace = mapper.readValue(is, RehydratedWorkspace.class); return workspace; }
From source file:org.ow2.chameleon.everest.servlet.JsonUtils.java
public static Json get(HttpServletRequest request) { // Once we have the request-based mapper, we keep it. if (request_json == null) { SimpleModule everest = new SimpleModule("Everest"); everest.addSerializer(new PathSerializer(request, EverestServlet.EVEREST_SERVLET_PATH)); ObjectMapper mapper = new ObjectMapper(); mapper.registerModule(everest); request_json = new Json(mapper); }/*from ww w . ja v a 2s . c o m*/ return request_json; }
From source file:eu.trentorise.opendata.commons.jackson.TodCommonsModule.java
/** * Registers in the provided object mapper the jackson tod commons module * and also the required guava module.//from w w w .j a va 2 s . c o m */ public static void registerModulesInto(ObjectMapper om) { om.registerModule(new GuavaModule()); om.registerModule(new TodCommonsModule()); }