All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.jobrunr.utils.mapper.gson.LocalDateAdapter Maven / Gradle / Ivy

package org.jobrunr.utils.mapper.gson;

import com.google.gson.TypeAdapter;
import com.google.gson.stream.JsonReader;
import com.google.gson.stream.JsonWriter;

import java.io.IOException;
import java.time.LocalDate;

public class LocalDateAdapter extends TypeAdapter {
    @Override
    public void write(final JsonWriter jsonWriter, final LocalDate localDate) throws IOException {
        jsonWriter.value(localDate.toString());
    }

    @Override
    public LocalDate read(final JsonReader jsonReader) throws IOException {
        return LocalDate.parse(jsonReader.nextString());
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy