Interface StringDocument
-
- All Superinterfaces:
FilterableDocument
,NoContentDocument
public interface StringDocument extends FilterableDocument
A filterable String Document
-
-
Field Summary
Fields Modifier and Type Field Description static org.apache.logging.log4j.Logger
logger
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description StringDocument
cloneWithMetadata(com.google.common.collect.ListMultimap<String,String> metadata)
Gets a clone of the document with the given metadata.StringDocument
cloneWithStringContent(DocumentType documentType, String content)
Creates a clone of the document with the given content and document type.StringDocument
cloneWithURI(URI uri)
Gets a clone of the document with a different URI.Optional<Charset>
getCharset()
Charset of a StringDocument are always UTF-8, if the document contains any indication of charset it must be UTF-8String
getContentAsString()
Gets the document content as a string.-
Methods inherited from interface com.funnelback.filter.api.documents.FilterableDocument
cloneWithDocumentType, getCopyOfContents
-
Methods inherited from interface com.funnelback.filter.api.documents.NoContentDocument
getCopyOfMetadata, getDocumentType, getMetadata, getURI
-
-
-
-
Method Detail
-
getContentAsString
String getContentAsString()
Gets the document content as a string.- Returns:
- the content of the document as a string.
-
cloneWithURI
StringDocument cloneWithURI(URI uri)
Description copied from interface:FilterableDocument
Gets a clone of the document with a different URI.- Specified by:
cloneWithURI
in interfaceFilterableDocument
- Parameters:
uri
- the document returned document will have.- Returns:
- A new document with the given URI.
-
cloneWithMetadata
StringDocument cloneWithMetadata(com.google.common.collect.ListMultimap<String,String> metadata)
Description copied from interface:FilterableDocument
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.- Specified by:
cloneWithMetadata
in interfaceFilterableDocument
- Parameters:
metadata
- The only metadata that the returbed document will have.- Returns:
- A new document with the given headers.
-
cloneWithStringContent
StringDocument cloneWithStringContent(DocumentType documentType, String content)
Creates a clone of the document with the given content and document type.- Parameters:
documentType
- the type of content. Typically a predefined type fromDocumentType
should be used, otherwise a custom value can be built withDocumentTypeFactory.fromContentTypeHeader(String)
available from theFilterContext
.content
- The new content.- Returns:
- a copy of the document with the new content and DocumentType.
-
getCharset
Optional<Charset> getCharset()
Charset of a StringDocument are always UTF-8, if the document contains any indication of charset it must be UTF-8- Specified by:
getCharset
in interfaceNoContentDocument
- Returns:
- the charset of a document which is always UTF-8.
-
-