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

io.sphere.sdk.projects.TrialUntilDeserializer Maven / Gradle / Ivy

There is a newer version: 1.0.0-M26
Show newest version
package io.sphere.sdk.projects;

import com.fasterxml.jackson.core.JsonParser;
import com.fasterxml.jackson.databind.DeserializationContext;
import com.fasterxml.jackson.databind.deser.std.StdScalarDeserializer;

import java.io.IOException;
import java.time.ZonedDateTime;

final class TrialUntilDeserializer extends StdScalarDeserializer {
    private static final long serialVersionUID = 0L;

    public TrialUntilDeserializer() {
        super(ZonedDateTime.class);
    }

    @Override
    public ZonedDateTime deserialize(final JsonParser jsonParser, final DeserializationContext deserializationContext) throws IOException {
        final String value = deserializationContext.readValue(jsonParser, String.class);//value has the format "JJJJ-mm"
        return ZonedDateTime.parse(value + "-01T00:00:00.000Z");
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy