
br.com.anteros.ejabberd.api.utils.InstantDeserializer Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of Anteros-Ejabberd-Api Show documentation
Show all versions of Anteros-Ejabberd-Api Show documentation
Anteros Ejabberd API for Java.
The newest version!
package br.com.anteros.ejabberd.api.utils;
import com.google.gson.JsonDeserializationContext;
import com.google.gson.JsonDeserializer;
import com.google.gson.JsonElement;
import com.google.gson.JsonParseException;
import java.lang.reflect.Type;
import java.time.Instant;
import java.time.format.DateTimeParseException;
public class InstantDeserializer implements JsonDeserializer {
@Override
public Instant deserialize(JsonElement jsonElement, Type type, JsonDeserializationContext jsonDeserializationContext) throws JsonParseException {
try {
return Instant.parse(jsonElement.getAsString());
} catch (DateTimeParseException e) {
throw new JsonParseException(e);
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy