Interface FilterableDocument

  • All Superinterfaces:
    NoContentDocument
    All Known Subinterfaces:
    BytesDocument, StringDocument

    public interface FilterableDocument
    extends NoContentDocument
    A Document which can be filtered by the filter framework.

    All documents which can be filtered must extend this interface.

    Implementations must be immutable, this is to ensure that we can not have Filters which edit a document yet claim to be skipped.

    Further implementations should provide cloneWithX methods, to allow creating a new document rather than expose a constructor which is likely to change. Clients of implementations of this interface should avoid using constructors as they are likely to change.

    • Method Detail

      • getCopyOfContents

        byte[] getCopyOfContents()
        Returns a copy of the documents content as bytes.
        Returns:
        a mutable copy of the documents contents.
      • cloneWithURI

        FilterableDocument cloneWithURI​(URI uri)
        Gets a clone of the document with a different URI.
        Parameters:
        uri - the document returned document will have.
        Returns:
        A new document with the given URI.
      • cloneWithMetadata

        FilterableDocument cloneWithMetadata​(com.google.common.collect.ListMultimap<String,​String> metadata)
        Gets a clone of the document with the given metadata.

        Note that the returned document will only have the metadata given as a paramater to this method. Typically the result of NoContentDocument.getCopyOfMetadata() should be manipulated then passed to this function to preserve existing metadata.

        Parameters:
        metadata - The only metadata that the returbed document will have.
        Returns:
        A new document with the given headers.
      • cloneWithDocumentType

        FilterableDocument cloneWithDocumentType​(DocumentType documentType)
        Creates a clone of the document with the given document type.
        Parameters:
        documentType - the documen type of the returned document.
        Returns: