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

nl.vpro.domain.media.search.AbstractSearchResult Maven / Gradle / Ivy

Go to download

The basic domain classes for 'media', the core of POMS. Also, the 'update' XML bindings for it. It also contains some closely related domain classes like the enum to contain NICAM kijkwijzer settings.

There is a newer version: 8.3.1
Show newest version
/*
 * Copyright (C) 2010 Licensed under the Apache License, Version 2.0
 * VPRO The Netherlands
 */
package nl.vpro.domain.media.search;

import lombok.Getter;
import lombok.Setter;

import java.util.Collections;
import java.util.List;
import java.util.stream.Stream;

import jakarta.xml.bind.annotation.*;

@XmlType(
    name ="searchResult",
    propOrder =
        {
            "count",
            "result"
        }
)
@XmlAccessorType(XmlAccessType.PROPERTY)
public abstract class AbstractSearchResult implements SearchResult {

    /**
     * The total number of results (when no pager would have been applied)
     */
    @Getter
    @Setter
    protected Long count;

    protected List result;

    public AbstractSearchResult() {
    }

    protected AbstractSearchResult(final Long  count, final List result) {
        this.count = count;
        this.result = Collections.unmodifiableList(result);
    }

    @Override
    public final List getResult() {
        return result;
    }

    public final void setResult(List l) {
        this.result = Collections.unmodifiableList(l);
        this.count = (long) l.size();
    }


    @Override
    public String toString() {
        return "" + result;
    }

    /**
     * @since 7.2
     */
    public Stream stream() {
        return result == null ? Stream.empty() :  result.stream();
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy