Class FilterResult


  • public final class FilterResult
    extends java.lang.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

    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static FilterResult delete()
      Returned by a filter when it wants to delete the given document.
      static FilterResult of​(FilterableDocument filteredDocument)
      Returned by a filter when it has filtered a document returning a single document.
      static FilterResult of​(java.util.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.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • 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​(java.util.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.