List of usage examples for com.fasterxml.jackson.databind ObjectMapper registerModule
public ObjectMapper registerModule(Module module)
From source file:com.hellblazer.autoconfigure.configuration.YamlHelper.java
public static Configuration fromYaml(InputStream yaml) throws JsonParseException, JsonMappingException, IOException { ObjectMapper mapper = new ObjectMapper(new YAMLFactory()); mapper.registerModule(getModule()); return mapper.readValue(yaml, Configuration.class); }
From source file:org.springframework.social.twitter.api.impl.StreamEventMixin.java
private static TwitterProfile toProfile(final JsonNode node) throws IOException { if (null == node || node.isNull() || node.isMissingNode()) { return null; }/* ww w. ja v a2 s .co m*/ final ObjectMapper mapper = new ObjectMapper(); mapper.registerModule(new TwitterModule()); return mapper.reader(TwitterProfile.class).readValue(node); }
From source file:com.chiralBehaviors.groo.configuration.GrooConfiguration.java
public static GrooConfiguration fromYaml(InputStream yaml) throws JsonParseException, JsonMappingException, IOException { ObjectMapper mapper = new ObjectMapper(new YAMLFactory()); mapper.registerModule(new DiscoveryModule()); return mapper.readValue(yaml, GrooConfiguration.class); }
From source file:com.redhat.ipaas.api.v1.rest.ReadApiClientDataTest.java
private static ObjectMapper getObjectMapper() { ObjectMapper objectMapper = new ObjectMapper(); objectMapper.registerModule(new Jdk8Module()); return objectMapper; }
From source file:com.chiralBehaviors.slp.hive.configuration.HiveScopeConfiguration.java
public static HiveScopeConfiguration fromYaml(InputStream yaml) throws JsonParseException, JsonMappingException, IOException { ObjectMapper mapper = new ObjectMapper(new YAMLFactory()); mapper.registerModule(new EngineModule()); return mapper.readValue(yaml, HiveScopeConfiguration.class); }
From source file:com.spectralogic.ds3autogen.docspec.Ds3DocSpecParserImpl.java
private static ObjectMapper initDs3DocSpec() { final ObjectMapper objectMapper = new ObjectMapper(); objectMapper.registerModule(new GuavaModule()); return objectMapper; }
From source file:eu.trentorise.opendata.commons.jackson.OdtCommonsModule.java
/** * Registers in the provided object mapper the jackson odt commons module and * also the required guava module.//from ww w . j a v a2 s .co m */ public static void registerModulesInto(ObjectMapper om) { om.registerModule(new GuavaModule()); om.registerModule(new OdtCommonsModule()); }
From source file:fi.helsinki.opintoni.web.WebTestUtils.java
public static byte[] toJsonBytes(Object object) throws IOException { ObjectMapper mapper = new ObjectMapper(); mapper.setSerializationInclusion(JsonInclude.Include.NON_NULL); mapper.registerModule(new JavaTimeModule()); return mapper.writeValueAsBytes(object); }
From source file:keywhiz.testing.JsonHelpers.java
/** * Customized ObjectMapper for common settings. * * @return customized object mapper// w ww. ja va 2 s.co m */ private static ObjectMapper customizeObjectMapper() { ObjectMapper mapper = new ObjectMapper(); mapper.registerModule(new Jdk8Module()); mapper.registerModule(new GuavaModule()); mapper.registerModule(new LogbackModule()); mapper.registerModule(new GuavaExtrasModule()); mapper.registerModule(new FuzzyEnumModule()); mapper.setPropertyNamingStrategy(new AnnotationSensitivePropertyNamingStrategy()); mapper.setSubtypeResolver(new DiscoverableSubtypeResolver()); mapper.setSerializationInclusion(JsonInclude.Include.NON_NULL); return mapper; }
From source file:com.chiralBehaviors.groo.configuration.ChakaalConfiguration.java
public static ChakaalConfiguration fromYaml(InputStream yaml) throws JsonParseException, JsonMappingException, IOException { ObjectMapper mapper = new ObjectMapper(new YAMLFactory()); mapper.registerModule(new DiscoveryModule()); return mapper.readValue(yaml, ChakaalConfiguration.class); }