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

org.javers.mongosupport.MongoLong64JsonDeserializer Maven / Gradle / Ivy

There is a newer version: 7.6.1
Show newest version
package org.javers.mongosupport;

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;

public class MongoLong64JsonDeserializer implements JsonDeserializer {
    @Override
    public Long deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException {
        if (json.isJsonPrimitive()) {
            return json.getAsLong();
        } else {
            return context.deserialize(json, MongoLong64.class).getValue();
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy