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

com.github.useful_solutions.tosamara_sdk.classifier.deserializer.InfotabloDeserializer Maven / Gradle / Ivy

There is a newer version: 1.5
Show newest version
package com.github.useful_solutions.tosamara_sdk.classifier.deserializer;

import com.fasterxml.jackson.core.JsonParser;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.DeserializationContext;
import com.fasterxml.jackson.databind.JsonDeserializer;

import java.io.IOException;
import java.util.Optional;

public class InfotabloDeserializer extends JsonDeserializer {

    @Override
    public Boolean deserialize(JsonParser jsonParser, DeserializationContext deserializationContext) throws IOException, JsonProcessingException {
        String value = jsonParser.getText();
        return Optional.ofNullable(value)
                .map(s -> !s.equals("нет"))
                .orElse(null);
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy