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

nl.vpro.domain.api.AbstractSearch 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
/*
 * Copyright (C) 2014 All rights reserved
 * VPRO The Netherlands
 */
package nl.vpro.domain.api;

import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlSeeAlso;
import javax.xml.bind.annotation.XmlTransient;

import nl.vpro.domain.api.media.MediaSearch;
import nl.vpro.domain.api.media.MemberRefSearch;
import nl.vpro.domain.api.page.AssociationSearch;
import nl.vpro.domain.api.page.PageSearch;

/**
 * A Search interface but JAXB won't handle interfaces
 *
 * This is a {@link Matcher} that also has a method {@link #hasSearches}. So in other words the matching is
 *
 * @author Roelof Jan Koekoek
 * @since 3.3
 */
@XmlAccessorType(XmlAccessType.NONE)
@XmlSeeAlso({MediaSearch.class, PageSearch.class, MemberRefSearch.class, AssociationSearch.class})
@XmlTransient
public abstract class AbstractSearch extends AbstractMatcher {

    public abstract boolean hasSearches();

    protected AbstractSearch() {

    }

    protected AbstractSearch(Match match) {
        super(match);
    }


    protected static boolean atLeastOneHasSearches(Iterable... collections) {
        for (Iterable col : collections) {
            if (col != null) {
                if (col instanceof MatcherList) {
                    if (!((MatcherList) col).isEmpty()) {
                        return true;
                    }
                } else {
                    if (col.iterator().hasNext()) {
                        return true;
                    }
                }
            }
        }
        return false;
    }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy