Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 package com.fasterxml.jackson.datatype.joda;
 
 import org.joda.time.*;
 
 
public class JodaModule extends SimpleModule
    public JodaModule()
    {
        super(..version());
        // first deserializers
        addDeserializer(DateTime.class, DateTimeDeserializer.forType(DateTime.class));
        addDeserializer(Duration.classnew DurationDeserializer());
        addDeserializer(Instant.classnew InstantDeserializer());
        addDeserializer(LocalDate.classnew LocalDateDeserializer());
        addDeserializer(LocalTime.classnew LocalTimeDeserializer());
        addDeserializer(Period.classnew PeriodDeserializer());
        addDeserializer(ReadableDateTime.class, DateTimeDeserializer.forType(ReadableDateTime.class));
        addDeserializer(ReadableInstant.class, DateTimeDeserializer.forType(ReadableInstant.class));
        addDeserializer(Interval.classnew IntervalDeserializer());
        // then serializers:
        addSerializer(DateMidnight.classnew DateMidnightSerializer());
        addSerializer(DateTime.classnew DateTimeSerializer());
        addSerializer(Duration.classnew DurationSerializer());
        addSerializer(Instant.classnew InstantSerializer());
        addSerializer(LocalDateTime.classnew LocalDateTimeSerializer());
        addSerializer(LocalDate.classnew LocalDateSerializer());
        addSerializer(LocalTime.classnew LocalTimeSerializer());
        addSerializer(Interval.classnew IntervalSerializer());
    }
New to GrepCode? Check out our FAQ X