Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 package com.fasterxml.jackson.databind.ser.std;
 
 
Compared to regular java.util.Date serialization, we do use String representation here. Why? Basically to truncate of time part, since that should not be used by plain SQL date.
public class SqlDateSerializer
    public SqlDateSerializer() { super(java.sql.Date.class); }
    @Override
    public void serialize(java.sql.Date valueJsonGenerator jgenSerializerProvider provider)
        throws IOExceptionJsonGenerationException
    {
        jgen.writeString(value.toString());
    }
    @Override
    public JsonNode getSchema(SerializerProvider providerType typeHint)
    {
        //todo: (ryan) add a format for the date in the schema?
        return createSchemaNode("string"true);
    }
    
    @Override
    public void acceptJsonFormatVisitor(JsonFormatVisitorWrapper visitorJavaType typeHint)
    {
    }
New to GrepCode? Check out our FAQ X