Class StandardWriterResolver
java.lang.Object
org.springframework.restdocs.snippet.StandardWriterResolver
- All Implemented Interfaces:
WriterResolver
Standard implementation of
WriterResolver
.- Author:
- Andy Wilkinson
-
Constructor Summary
ConstructorDescriptionStandardWriterResolver
(PlaceholderResolverFactory placeholderResolverFactory, String encoding, TemplateFormat templateFormat) Creates a newStandardWriterResolver
that will use aPropertyPlaceholderHelper.PlaceholderResolver
created from the givenplaceholderResolverFactory
to resolve any placeholders in theoperationName
. -
Method Summary
Modifier and TypeMethodDescriptionresolve
(String operationName, String snippetName, RestDocumentationContext context) Returns a writer that can be used to write the snippet with the given name for the operation with the given name.
-
Constructor Details
-
StandardWriterResolver
public StandardWriterResolver(PlaceholderResolverFactory placeholderResolverFactory, String encoding, TemplateFormat templateFormat) Creates a newStandardWriterResolver
that will use aPropertyPlaceholderHelper.PlaceholderResolver
created from the givenplaceholderResolverFactory
to resolve any placeholders in theoperationName
. Writers will use the givenencoding
and, when writing to a file, will use a filename appropriate for content generated from templates in the giventemplateFormat
.- Parameters:
placeholderResolverFactory
- the placeholder resolver factoryencoding
- the encodingtemplateFormat
- the snippet format
-
-
Method Details
-
resolve
public Writer resolve(String operationName, String snippetName, RestDocumentationContext context) throws IOException Description copied from interface:WriterResolver
Returns a writer that can be used to write the snippet with the given name for the operation with the given name.- Specified by:
resolve
in interfaceWriterResolver
- Parameters:
operationName
- the name of the operation that is being documentedsnippetName
- the name of the snippetcontext
- the current documentation context- Returns:
- the writer
- Throws:
IOException
- if a writer cannot be resolved
-