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

org.nd4j.linalg.primitives.serde.JsonDeserializerAtomicDouble Maven / Gradle / Ivy

There is a newer version: 1.0.0-M2.1
Show newest version
package org.nd4j.linalg.primitives.serde;

import org.nd4j.linalg.primitives.AtomicDouble;
import org.nd4j.shade.jackson.core.JsonParser;
import org.nd4j.shade.jackson.core.JsonProcessingException;
import org.nd4j.shade.jackson.databind.DeserializationContext;
import org.nd4j.shade.jackson.databind.JsonDeserializer;
import org.nd4j.shade.jackson.databind.JsonNode;

import java.io.IOException;

public class JsonDeserializerAtomicDouble extends JsonDeserializer {
    @Override
    public AtomicDouble deserialize(JsonParser jsonParser, DeserializationContext deserializationContext) throws IOException, JsonProcessingException {
        JsonNode node = jsonParser.getCodec().readTree(jsonParser);
        double value = node.asDouble();
        return new AtomicDouble(value);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy