[New] Allow to set input for strolch search
This commit is contained in:
parent
178ad78dea
commit
4ffd92e0a7
|
@ -1,5 +1,6 @@
|
|||
package li.strolch.search;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import li.strolch.exception.StrolchAccessDeniedException;
|
||||
|
@ -105,6 +106,42 @@ public abstract class StrolchSearch<T extends StrolchRootElement>
|
|||
return new RootElementSearchResult<>(stream);
|
||||
}
|
||||
|
||||
/**
|
||||
* Performs the actual search on the given input list
|
||||
*
|
||||
* @return the search result
|
||||
*/
|
||||
public RootElementSearchResult<T> search(List<T> input) {
|
||||
|
||||
// first prepare
|
||||
define();
|
||||
|
||||
Stream<T> stream = input.stream();
|
||||
|
||||
if (this.expression != null)
|
||||
stream = stream.filter(e -> this.expression.matches(e));
|
||||
|
||||
return new RootElementSearchResult<>(stream);
|
||||
}
|
||||
|
||||
/**
|
||||
* Performs the actual search on the given input stream
|
||||
*
|
||||
* @return the search result
|
||||
*/
|
||||
public RootElementSearchResult<T> search(Stream<T> input) {
|
||||
|
||||
// first prepare
|
||||
define();
|
||||
|
||||
Stream<T> stream = input;
|
||||
|
||||
if (this.expression != null)
|
||||
stream = stream.filter(e -> this.expression.matches(e));
|
||||
|
||||
return new RootElementSearchResult<>(stream);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see li.strolch.privilege.model.Restrictable#getPrivilegeName()
|
||||
*/
|
||||
|
|
Loading…
Reference in New Issue