nl.vpro.domain.media.search.AbstractSearchResult Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of media-domain Show documentation
Show all versions of media-domain Show documentation
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.
/*
* 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();
}
}