Example usage for com.fasterxml.jackson.datatype.joda JodaModule JodaModule

List of usage examples for com.fasterxml.jackson.datatype.joda JodaModule JodaModule

Introduction

In this page you can find the example usage for com.fasterxml.jackson.datatype.joda JodaModule JodaModule.

Prototype

public JodaModule() 

Source Link

Usage

From source file:com.metamx.rdiclient.RdiClients.java

/**
 * Makes a Joda-aware {@code JacksonSerializer} for generic type events.
 *///from  w w w  .  jav  a 2 s  .c o m
private static <T> Serializer<T> makeJacksonSerializer() {
    final ObjectMapper objectMapper = new ObjectMapper().registerModule(new JodaModule());
    return new JacksonSerializer<>(objectMapper);
}

From source file:com.addthis.codec.jackson.Jackson.java

public static ObjectMapper registerExtraModules(ObjectMapper objectMapper) {
    objectMapper.registerModule(new GuavaModule());
    objectMapper.registerModule(new Jdk8Module());
    // jsr310 is basically just the jdk 8 date/time classes split into its own module
    objectMapper.registerModule(new JSR310Module());
    objectMapper.registerModule(new JodaModule());
    objectMapper.registerModule(new ExecutorsModule());
    return objectMapper;
}

From source file:com.anrisoftware.simplerest.oanda.rest.NamedListParseResponse.java

private ObjectMapper createParserMapper() {
    ObjectMapper mapper = new ObjectMapper();
    mapper.registerModule(new JodaModule());
    return mapper;
}

From source file:com.ning.killbill.zuora.osgi.ZuoraActivator.java

@Override
public void start(final BundleContext context) throws Exception {

    super.start(context);

    // Configure slf4j for libraries (e.g. config-magic)
    StaticLoggerBinder.getSingleton().setLogService(logService);

    config = readConfigFromSystemProperties(DEFAULT_INSTANCE_NAME);
    mapper = new ObjectMapper();
    mapper.registerModule(new JodaModule());
    api = new ZuoraApi(config, logService);
    factory = new ConnectionFactory(config, api, logService);
    pool = new ConnectionPool(factory, config);

    zuoraPluginDao = config.useJPADAOImplementation() ? new JPAZuoraPluginDao(dataSource.getDataSource())
            : new JDBIZuoraPluginDao(dataSource.getDataSource());

    final DefaultKillbillApi defaultKillbillApi = new DefaultKillbillApi(killbillAPI, logService);
    zuoraPaymentPluginApi = new ZuoraPaymentPluginApi(pool, api, logService, defaultKillbillApi, zuoraPluginDao,
            DEFAULT_INSTANCE_NAME);//from w w w.ja  v a 2  s  .  c  om
    zuoraPrivateApi = new DefaultZuoraPrivateApi(pool, api, logService, defaultKillbillApi, zuoraPluginDao,
            DEFAULT_INSTANCE_NAME);

    zuoraHttpServlet = new ZuoraHttpServlet(zuoraPrivateApi, zuoraPluginDao, mapper);

    registerPaymentPluginApi(context, zuoraPaymentPluginApi);
    registerServlet(context, zuoraHttpServlet);
}

From source file:org.killbill.billing.plugin.meter.timeline.persistent.FileBackedBuffer.java

public FileBackedBuffer(final String basePath, final String prefix, final boolean deleteFilesOnClose,
        final int segmentsSize, final int maxNbSegments) throws IOException {
    this.basePath = basePath;
    this.prefix = prefix;
    this.deleteFilesOnClose = deleteFilesOnClose;

    smileObjectMapper = new ObjectMapper(smileFactory);
    smileObjectMapper.registerModule(new JodaModule());
    smileObjectMapper.enable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS);

    final MemBuffersForBytes bufs = new MemBuffersForBytes(segmentsSize, 1, maxNbSegments);
    inputBuffer = bufs.createStreamyBuffer(1, maxNbSegments);

    recycle();//from  w  w  w . j  ava 2s.  co m
}

From source file:com.feedeo.rest.client.AbstractRestClient.java

protected ObjectMapper createObjectMapper() {
    ObjectMapper objectMapper = new ObjectMapper();
    objectMapper.configure(WRITE_DATES_AS_TIMESTAMPS, true);
    objectMapper.configure(WRITE_ENUMS_USING_TO_STRING, true);
    objectMapper.configure(READ_ENUMS_USING_TO_STRING, true);

    objectMapper.registerModule(new JodaModule());

    objectMapper.setTimeZone(getDefault());

    return objectMapper;
}

From source file:org.nohope.jongo.JacksonProcessor.java

@Nonnull
private static ObjectMapper createPreConfiguredMapper() {
    final ObjectMapper mapper = new ObjectMapper();
    mapper.registerModule(new JodaModule());
    mapper.registerModule(new ColorModule());

    mapper.configure(FAIL_ON_UNKNOWN_PROPERTIES, false);
    mapper.configure(AUTO_DETECT_GETTERS, false);
    mapper.configure(AUTO_DETECT_SETTERS, false);
    mapper.setSerializationInclusion(NON_NULL);
    mapper.setVisibilityChecker(VisibilityChecker.Std.defaultInstance().withFieldVisibility(ANY));

    mapper.enableDefaultTypingAsProperty(ObjectMapper.DefaultTyping.NON_FINAL,
            JsonTypeInfo.Id.CLASS.getDefaultPropertyName());

    final SimpleModule module = new SimpleModule("jongo", Version.unknownVersion());
    module.addKeySerializer(Object.class, ComplexKeySerializer.S_OBJECT);
    module.addKeyDeserializer(String.class, ComplexKeyDeserializer.S_OBJECT);
    module.addKeyDeserializer(Object.class, ComplexKeyDeserializer.S_OBJECT);

    //addBSONTypeSerializers(module);

    mapper.registerModule(module);//from  ww  w .j  a  v  a  2s .  co m
    return mapper;
}

From source file:com.hp.autonomy.frontend.find.core.savedsearches.query.AbstractSavedQueryIT.java

protected AbstractSavedQueryIT() {
    mapper.registerModule(new JodaModule());
}

From source file:com.basho.riak.client.convert.JSONConverter.java

/**
 * Create a JSONConverter for creating instances of <code>clazz</code> from
 * JSON and instances of {@link IRiakObject} with a JSON payload from
 * instances of <code>clazz</code>
 * /*from  www  . ja  v a 2s.  c  om*/
 * @param clazz the type to convert to/from
 * @param bucket the bucket
 * @param defaultKey
 *            for cases where <code>clazz</code> does not have a
 *            {@link RiakKey} annotated field, pass the key to use in this
 *            conversion.
 */
public JSONConverter(Class<T> clazz, String bucket, String defaultKey) {
    this.clazz = clazz;
    this.bucket = bucket;
    this.defaultKey = defaultKey;
    this.usermetaConverter = new UsermetaConverter<T>();
    this.riakIndexConverter = new RiakIndexConverter<T>();
    this.riakLinksConverter = new RiakLinksConverter<T>();
    objectMapper.registerModule(new RiakJacksonModule());
    objectMapper.registerModule(new JodaModule());
}

From source file:com.autodesk.client.ApiClient.java

public ApiClient() {
    objectMapper = new ObjectMapper();
    objectMapper.setSerializationInclusion(JsonInclude.Include.NON_NULL);
    objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
    objectMapper.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS);
    objectMapper.enable(SerializationFeature.WRITE_ENUMS_USING_TO_STRING);
    objectMapper.enable(DeserializationFeature.READ_ENUMS_USING_TO_STRING);
    objectMapper.registerModule(new JodaModule());
    objectMapper.setDateFormat(ApiClient.buildDefaultDateFormat());

    dateFormat = ApiClient.buildDefaultDateFormat();
    rebuildHttpClient();//from w  w w.  j  av a 2  s  .  c o m
}