com.urbanairship.api.common.parse.CommonObjectMapper Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of java-client Show documentation
Show all versions of java-client Show documentation
The Urban Airship Java client library
/*
* Copyright (c) 2013-2016. Urban Airship and Contributors
*/
package com.urbanairship.api.common.parse;
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.module.SimpleModule;
import org.joda.time.DateTime;
public class CommonObjectMapper {
private static final ObjectMapper MAPPER = new ObjectMapper();
private static final SimpleModule MODULE = new SimpleModule("Common API Module");
static {
MODULE
.addSerializer(DateTime.class, new DateTimeSerializer())
.addDeserializer(DateTime.class, new DateTimeDeserializer());
MAPPER.registerModule(MODULE);
MAPPER.configure(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY, true);
}
public static SimpleModule getModule() {
return MODULE;
}
public static ObjectMapper getInstance() {
return MAPPER;
}
private CommonObjectMapper() { }
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy