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

nl.vpro.domain.api.TextMatcherList Maven / Gradle / Ivy

Go to download

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

There is a newer version: 8.3.3
Show newest version
package nl.vpro.domain.api;

import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;
import java.util.stream.Stream;

import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;

import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;

import nl.vpro.domain.api.jackson.TextMatcherListJson;

/**
 * @author Michiel Meeuwissen
 * @since 3.0
 */
@XmlAccessorType(XmlAccessType.NONE)
@XmlType(name = "textMatcherListType")
@JsonSerialize(using = TextMatcherListJson.Serializer.class)
@JsonDeserialize(using = TextMatcherListJson.Deserializer.class)
public class TextMatcherList extends AbstractTextMatcherList {

    public static TextMatcherList must(TextMatcher... values) {
        return new TextMatcherList(Match.MUST, values);
    }

    public static TextMatcherList must(Stream values) {
        return new TextMatcherList(values.collect(Collectors.toList()), Match.MUST);
    }

    public static TextMatcherList should(TextMatcher... values) {
        return new TextMatcherList(Match.SHOULD, values);
    }

    public static TextMatcherList should(Stream values) {
        return new TextMatcherList(values.collect(Collectors.toList()), Match.SHOULD);
    }

    public static TextMatcherList not(TextMatcher... values) {
        return new TextMatcherList(Match.NOT, values);
    }

    public static TextMatcherList not(Stream values) {
        return new TextMatcherList(values.collect(Collectors.toList()), Match.NOT);
    }

    public TextMatcherList() {
        super();
    }

    public TextMatcherList(List values, Match match) {
        super(match, values);
        this.matchers = values;
    }

    public TextMatcherList(TextMatcher... values) {
        super(DEFAULT_MATCH, Arrays.asList(values));
    }


    public TextMatcherList(Match match, TextMatcher... values) {
        super(match, Arrays.asList(values));
    }


    @Override
    @XmlElement(name = "matcher")
    public List getMatchers() {
        return super.getMatchers();
    }

    @Override
    public void setMatchers(List matchers) {
        super.setMatchers(matchers);
    }


}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy