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

nl.vpro.domain.api.MultipleFacetsResult 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 java.util.ArrayList;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;

import org.checkerframework.checker.nullness.qual.NonNull;
import javax.xml.bind.annotation.*;

/**
 * Used on fields that may return multiple facets e.g., relations. The field name does not suffice in these cases.
 *
 * @author Roelof Jan Koekoek
 * @since 3.3
 */
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "namedTermFacetResultItemType")
public class MultipleFacetsResult implements Nameable, Iterable  {

    @XmlAttribute
    private String name;

    @XmlElement(name = "facet")
    private List facets;

    public MultipleFacetsResult() {
    }

    public MultipleFacetsResult(String name, List facets) {
        this.name = name;
        this.facets = facets;
    }

    @Override
    public String getName() {
        return this.name;
    }

    @Override
    public void setName(String name) {
        this.name = name;
    }

    public List getFacets() {
        if (facets == null) {
            facets = new ArrayList<>();
        }
        return facets;
    }

    public void setFacets(List facets) {
        this.facets = facets;
    }

    @NonNull
    @Override
    public Iterator iterator() {
        if (facets == null) {
            return Collections.emptyIterator();
        } else {            return facets.iterator();
        }
    }

    @Override
    public String toString () {
        return "facet result '" + name + "' " + facets;
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy