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

com.codepoetics.octarine.json.deserialisation.Deserialisers Maven / Gradle / Ivy

There is a newer version: 0.18
Show newest version
package com.codepoetics.octarine.json.deserialisation;

import com.codepoetics.octarine.records.Valid;
import com.codepoetics.octarine.records.Validation;
import com.fasterxml.jackson.core.JsonParser;

import java.util.function.Function;

public final class Deserialisers {

    private Deserialisers() {
    }

    public static final SafeDeserialiser ofString = JsonParser::getValueAsString;
    public static final SafeDeserialiser ofInteger = JsonParser::getIntValue;
    public static final SafeDeserialiser ofBoolean = JsonParser::getBooleanValue;
    public static final SafeDeserialiser ofLong = JsonParser::getLongValue;
    public static final SafeDeserialiser ofDouble = JsonParser::getDoubleValue;

    public static  SafeDeserialiser> ofValid(Function> extractor) {
        return parser -> extractor.apply(parser).get();
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy