Class FilterResult
- java.lang.Object
-
- com.funnelback.filter.api.FilterResult
-
public final class FilterResult extends Object
The result of filtering a document.Can either be FilterResult.skipped() if filtering was not done or FilterResult.of() if the documents where filtered
-
-
Field Summary
Fields Modifier and Type Field Description private List<FilterableDocument>
filteredDocuments
private boolean
skipped
private static FilterResult
SKIPPED
-
Constructor Summary
Constructors Modifier Constructor Description private
FilterResult()
private
FilterResult(boolean skipped, List<FilterableDocument> filteredDocuments)
private
FilterResult(FilterableDocument filterableDocument)
private
FilterResult(Collection<? extends FilterableDocument> filteredDocs)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static FilterResult
delete()
Returned by a filter when it wants to delete the given document.boolean
equals(Object o)
List<FilterableDocument>
getFilteredDocuments()
int
hashCode()
boolean
isSkipped()
static FilterResult
of(FilterableDocument filteredDocument)
Returned by a filter when it has filtered a document returning a single document.static FilterResult
of(Collection<? extends FilterableDocument> filteredDocuments)
Returned by a filter when it has filtered a document into many documents.static FilterResult
skipped()
Marks a filter as being skipped.
-
-
-
Field Detail
-
SKIPPED
private static FilterResult SKIPPED
-
skipped
private boolean skipped
-
filteredDocuments
private List<FilterableDocument> filteredDocuments
-
-
Constructor Detail
-
FilterResult
private FilterResult(FilterableDocument filterableDocument)
-
FilterResult
private FilterResult()
-
FilterResult
private FilterResult(boolean skipped, List<FilterableDocument> filteredDocuments)
-
FilterResult
private FilterResult(Collection<? extends FilterableDocument> filteredDocs)
-
-
Method Detail
-
skipped
public static FilterResult skipped()
Marks a filter as being skipped.A skipped filter tells other filters (ChoiceFilter and ChainFilter) that this filter was unable to run. A skipped status lets the choice filter choose a different filter to run. A skipped status causes the chain filter to pass the input document to the next filter in the chain.
- Returns:
- a skipped FilterResult.
-
delete
public static FilterResult delete()
Returned by a filter when it wants to delete the given document.This is used to claim that the filer ran and decided to remove the given document. This is the same as passing an empty list to of().
- Returns:
- a FilterResult containing zero documents.
-
of
public static FilterResult of(FilterableDocument filteredDocument)
Returned by a filter when it has filtered a document returning a single document.This is used to claim that the filter ran and the given document is the result of the filter running. This may be called with the original unmodified document to show that the filter ran and stopping the choice filter from choosing another filter.
- Parameters:
filteredDocument
- the resulting document from filtering.- Returns:
- a FilterResult containing one document.
-
of
public static FilterResult of(Collection<? extends FilterableDocument> filteredDocuments)
Returned by a filter when it has filtered a document into many documents.This is used to claim that that filter ran and produced the given collection of documents. The collection of documents can be empty showing the filter ran yet removed the input document.
- Parameters:
filteredDocuments
- the result of filtering a document which can be zero or more documents.- Returns:
- a FilterResult containing the given list of documents.
-
isSkipped
public boolean isSkipped()
-
getFilteredDocuments
public List<FilterableDocument> getFilteredDocuments()
-
-