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

nl.vpro.domain.api.jackson.TextMatcherJson Maven / Gradle / Ivy

Go to download

Contains the objects used by the Frontend API, like forms and result objects

The newest version!
package nl.vpro.domain.api.jackson;

import java.io.IOException;

import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.core.JsonParser;
import com.fasterxml.jackson.databind.DeserializationContext;
import com.fasterxml.jackson.databind.JsonDeserializer;
import com.fasterxml.jackson.databind.JsonSerializer;
import com.fasterxml.jackson.databind.SerializerProvider;

import nl.vpro.domain.api.StandardMatchType;
import nl.vpro.domain.api.TextMatcher;

/**
 * @author Michiel Meeuwissen
 * @since 2.3
 */
public class TextMatcherJson extends AbstractTextMatcherJson {
    private static final TextMatcherJson SERIALIZER = new TextMatcherJson();

    public TextMatcherJson() {
        super(TextMatcher::new, StandardMatchType::valueOf);
    }

    public static class Serializer extends JsonSerializer {
        @Override
        public void serialize(TextMatcher value, JsonGenerator jgen, SerializerProvider provider) throws IOException {
            SERIALIZER.serialize(value, jgen, provider);
        }
    }

    public static class Deserializer extends JsonDeserializer {
        @Override
        public TextMatcher deserialize(JsonParser p, DeserializationContext ctxt) throws IOException {
            return SERIALIZER.deserialize(p, ctxt);
        }
    }



}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy