com.gooddata.sdk.common.util.GDDateSerializer Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of gooddata-rest-common Show documentation
Show all versions of gooddata-rest-common Show documentation
GoodData REST Common Library
/*
* Copyright (C) 2004-2017, GoodData(R) Corporation. All rights reserved.
* This source code is licensed under the BSD-style license found in the
* LICENSE.txt file in the root directory of this source tree.
*/
package com.gooddata.sdk.common.util;
import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.databind.JsonSerializer;
import com.fasterxml.jackson.databind.SerializerProvider;
import org.joda.time.LocalDate;
import java.io.IOException;
import static com.gooddata.sdk.common.util.GDDateDeserializer.FORMATTER;
/**
* Serializes from Joda's {@link LocalDate} fields to the GoodData date time format (yyyy-MM-dd).
*/
public class GDDateSerializer extends JsonSerializer {
@Override
public void serialize(LocalDate value, JsonGenerator gen, SerializerProvider arg2) throws IOException {
gen.writeString(FORMATTER.print(value));
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy