use of com.fasterxml.jackson.datatype.joda.JodaModule in project CzechIdMng by bcvsolutions.
the class WebConfig method objectMapper.
/**
* Adds joda time json module
*/
@Bean
public ObjectMapper objectMapper() {
ObjectMapper mapper = super.objectMapper();
mapper.registerModule(new JodaModule());
return mapper;
}
use of com.fasterxml.jackson.datatype.joda.JodaModule in project api-core by ca-cwds.
the class ObjectMapperUtils method configureObjectMapper.
/**
* Configure given ObjectMapper.
*
* {@link ObjectMapper}, used to deserialize JSON Strings from source into instances of chosen
* type.
*
* <p>
* This mapper is thread-safe and reusable across multiple threads, yet any configuration made to
* it, such as ignoring unknown JSON properties, applies to ALL target class types.
* </p>
*
* <p>
* Relax strict constraints regarding unknown JSON properties, since API classes may change over
* time, and not all classes emit version information in JSON.
* </p>
*
* <p>
* Fixes bug #140710983: Bug: Person Search converts dates to GMT. Set default time zone to JVM
* default, which must match the database and Elasticsearch server.
* </p>
*
* @param objectMapper ObjectMapper to configure
*/
public static void configureObjectMapper(ObjectMapper objectMapper) {
objectMapper.setSerializationInclusion(JsonInclude.Include.NON_NULL);
objectMapper.enable(SerializationFeature.INDENT_OUTPUT);
objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
objectMapper.configure(DeserializationFeature.FAIL_ON_NULL_FOR_PRIMITIVES, false);
// The mainframe DB2 database runs in PST, and so we must too.
final TimeZone tz = TimeZone.getTimeZone("America/Los_Angeles");
final DateFormat fmt = new SimpleDateFormat("yyyy-MM-dd");
fmt.setTimeZone(tz);
objectMapper.setDateFormat(fmt);
objectMapper.getSerializationConfig().with(fmt);
objectMapper.setTimeZone(tz);
objectMapper.getSerializationConfig().with(tz);
objectMapper.registerModule(new JodaModule());
}
use of com.fasterxml.jackson.datatype.joda.JodaModule in project embulk by embulk.
the class ExecModule method configure.
@Override
public void configure(Binder binder) {
Preconditions.checkNotNull(binder, "binder is null.");
binder.bind(BulkLoader.class);
binder.bind(ILoggerFactory.class).toProvider(LoggerProvider.class).in(Scopes.SINGLETON);
binder.bind(ModelManager.class).in(Scopes.SINGLETON);
binder.bind(BufferAllocator.class).to(PooledBufferAllocator.class).in(Scopes.SINGLETON);
binder.bind(TempFileAllocator.class).in(Scopes.SINGLETON);
// GuessExecutor, PreviewExecutor
registerPluginTo(binder, ParserPlugin.class, "system_guess", GuessExecutor.GuessParserPlugin.class);
registerPluginTo(binder, ParserPlugin.class, "system_sampling", SamplingParserPlugin.class);
// LocalExecutorPlugin
registerPluginTo(binder, ExecutorPlugin.class, "local", LocalExecutorPlugin.class);
// serde
ObjectMapperModule mapper = new ObjectMapperModule();
DateTimeZoneSerDe.configure(mapper);
TimestampSerDe.configure(mapper);
CharsetSerDe.configure(mapper);
LocalFileSerDe.configure(mapper);
// jackson-datatype-guava
mapper.registerModule(new GuavaModule());
// jackson-datatype-joda
mapper.registerModule(new JodaModule());
mapper.configure(binder);
}
use of com.fasterxml.jackson.datatype.joda.JodaModule in project nakadi by zalando.
the class JsonConfig method jacksonObjectMapper.
@Bean
@Primary
public ObjectMapper jacksonObjectMapper() {
final ObjectMapper objectMapper = new ObjectMapper().setPropertyNamingStrategy(CAMEL_CASE_TO_LOWER_CASE_WITH_UNDERSCORES);
objectMapper.registerModule(enumModule());
objectMapper.registerModule(new Jdk8Module());
objectMapper.registerModule(new ProblemModule());
objectMapper.registerModule(new JodaModule());
objectMapper.configure(WRITE_DATES_AS_TIMESTAMPS, false);
objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
return objectMapper;
}
use of com.fasterxml.jackson.datatype.joda.JodaModule in project kylo by Teradata.
the class TriggerFeed method init.
@Override
protected void init(ProcessorInitializationContext context) {
super.init(context);
MAPPER.registerModule(new JodaModule());
MAPPER.configure(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS, true);
MAPPER.configure(SerializationFeature.FAIL_ON_EMPTY_BEANS, false);
this.preconditionListener = createPreconditionListener();
}
Aggregations