List of usage examples for com.fasterxml.jackson.datatype.guava GuavaModule GuavaModule
public GuavaModule()
From source file:org.mayocat.shop.payment.store.jdbi.mapper.GatewayTenantDataMapper.java
@Override public GatewayTenantData map(int index, ResultSet resultSet, StatementContext ctx) throws SQLException { UUID tenantId = (UUID) resultSet.getObject("tenant_id"); String gateway = resultSet.getString("gateway"); ObjectMapper mapper = new ObjectMapper(); mapper.registerModule(new GuavaModule()); try {//from w w w . ja va 2s . c o m Map<String, Object> data = mapper.readValue(resultSet.getString("tenant_data"), new TypeReference<Map<String, Object>>() { }); return new GatewayTenantData(tenantId, gateway, data); } catch (IOException e) { final Logger logger = LoggerFactory.getLogger(GatewayTenantDataMapper.class); logger.error("Failed to de-serialize gateway tenant data", e); return null; } }
From source file:io.sidecar.jackson.ModelMapper.java
private void register3rdPartyModules() { registerModule(new GuavaModule()); registerModule(new JodaModule()); }
From source file:io.instacount.client.jackson.InstacountClientObjectMapper.java
/** * No-args Constructor./*from www .ja v a2 s. c o m*/ * * @see "https://github.com/FasterXML/jackson-datatype-joda" */ public InstacountClientObjectMapper() { registerModule(new HttpUrlModule()); registerModule(new JodaModule()); registerModule(new GuavaModule()); configure(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS, false); configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); setDateFormat(new ISO8601DateFormat()); }
From source file:com.monarchapis.driver.jaxrs.common.JacksonContextResolver.java
public JacksonContextResolver() { mapper = new ObjectMapper(); mapper.registerModule(new JodaModule()); mapper.registerModule(new GuavaModule()); mapper.configure(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS, false); }
From source file:com.github.luluvise.droid_utils.json.jackson.JacksonJsonManager.java
/** * Register {@link GuavaModule} module for Guava data structures *//*from www . j a v a 2 s . co m*/ public static void registerGuavaModule() { INSTANCE.mMapper.registerModule(new GuavaModule()); }
From source file:eu.trentorise.opendata.commons.jackson.Jacksonizer.java
private Jacksonizer() { objectMapper = new ObjectMapper(); objectMapper.registerModule(new GuavaModule()); objectMapper.registerModule(new TodCommonsModule()); }
From source file:org.graylog.plugins.usagestatistics.providers.SmileObjectMapperProvider.java
public SmileObjectMapperProvider() { final SmileFactory smileFactory = new SmileFactory().disable(SmileGenerator.Feature.ENCODE_BINARY_AS_7BIT) .enable(SmileGenerator.Feature.WRITE_END_MARKER); objectMapper = new ObjectMapper(smileFactory).setPropertyNamingStrategy(PropertyNamingStrategy.SNAKE_CASE) .registerModule(new JodaModule()).registerModule(new GuavaModule()); }
From source file:org.mayocat.accounts.store.jdbi.mapper.TenantMapper.java
@Override public Tenant map(int index, ResultSet result, StatementContext statementContext) throws SQLException { String slug = result.getString("slug"); String defaultHost = result.getString("default_host"); ObjectMapper mapper = new ObjectMapper(); mapper.registerModule(new GuavaModule()); Integer configurationVersion = result.getInt("configuration_version"); TenantConfiguration configuration;/*from www . j ava 2 s . c o m*/ if (Strings.isNullOrEmpty(result.getString("configuration"))) { configuration = new TenantConfiguration(configurationVersion, Collections.<String, Serializable>emptyMap()); } else { try { Map<String, Serializable> data = mapper.readValue(result.getString("configuration"), new TypeReference<Map<String, Object>>() { }); configuration = new TenantConfiguration(configurationVersion, data); } catch (IOException e) { final Logger logger = LoggerFactory.getLogger(TenantMapper.class); logger.error("Failed to load configuration for tenant with slug [{}]", e); configuration = new TenantConfiguration(); } } Tenant tenant = new Tenant((UUID) result.getObject("id"), slug, configuration); tenant.setFeaturedImageId((UUID) result.getObject("featured_image_id")); tenant.setSlug(slug); tenant.setDefaultHost(defaultHost); tenant.setCreationDate(result.getTimestamp("creation_date")); tenant.setName(result.getString("name")); tenant.setDescription(result.getString("description")); tenant.setContactEmail(result.getString("contact_email")); return tenant; }
From source file:com.spectralogic.ds3autogen.Ds3SpecParserImpl.java
public Ds3SpecParserImpl() { module = new JacksonXmlModule(); module.setDefaultUseWrapper(false);/*from w ww.j a va 2s . co m*/ mapper = new XmlMapper(module); mapper.registerModule(new GuavaModule()); final SimpleFilterProvider filterProvider = new SimpleFilterProvider().setFailOnUnknownId(false); mapper.setFilters(filterProvider); }
From source file:org.mayocat.shop.payment.store.jdbi.mapper.PaymentOperationMapper.java
@Override public PaymentOperation map(int index, ResultSet resultSet, StatementContext ctx) throws SQLException { PaymentOperation operation = new PaymentOperation(); operation.setId((UUID) resultSet.getObject("operation_id")); operation.setOrderId((UUID) resultSet.getObject("order_id")); operation.setExternalId(resultSet.getString("external_id")); operation.setGatewayId(resultSet.getString("gateway_id")); operation.setResult(PaymentOperation.Result.valueOf(resultSet.getString("result"))); ObjectMapper mapper = new ObjectMapper(); mapper.registerModule(new GuavaModule()); if (resultSet.getString("memo") != null) { try {// ww w . j a v a 2 s . c om Map<String, Object> data = mapper.readValue(resultSet.getString("memo"), new TypeReference<Map<String, Object>>() { }); operation.setMemo(data); } catch (IOException e) { final Logger logger = LoggerFactory.getLogger(PaymentOperationMapper.class); logger.error("Failed to de-serialize payment operation memo", e); } } return operation; }