Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 package com.fasterxml.jackson.datatype.joda.ser;
 
 
 
public final class LocalDateTimeSerializer
    final static DateTimeFormatter format = ISODateTimeFormat.dateTime();
    
    public LocalDateTimeSerializer() { super(LocalDateTime.class); }
    @Override
    public void serialize(LocalDateTime dtJsonGenerator jgenSerializerProvider provider)
        throws IOExceptionJsonGenerationException
    {
            // Timestamp here actually means an array of values
            jgen.writeStartArray();
            jgen.writeNumber(dt.year().get());
            jgen.writeNumber(dt.monthOfYear().get());
            jgen.writeNumber(dt.dayOfMonth().get());
            jgen.writeNumber(dt.hourOfDay().get());
            jgen.writeNumber(dt.minuteOfHour().get());
            jgen.writeNumber(dt.secondOfMinute().get());
            jgen.writeNumber(dt.millisOfSecond().get());
            jgen.writeEndArray();
        } else {
            jgen.writeString(.print(dt));
        }
    }
    @Override
    public JsonNode getSchema(SerializerProvider providerjava.lang.reflect.Type typeHint)
    {
                ? "array" : "string"true);
    }
New to GrepCode? Check out our FAQ X