Class StandardWriterResolver
java.lang.Object
org.springframework.restdocs.snippet.StandardWriterResolver
- All Implemented Interfaces:
WriterResolver
Standard implementation of
WriterResolver.- Author:
- Andy Wilkinson
-
Constructor Summary
ConstructorsConstructorDescriptionStandardWriterResolver(PlaceholderResolverFactory placeholderResolverFactory, String encoding, TemplateFormat templateFormat) Creates a newStandardWriterResolverthat will use aPropertyPlaceholderHelper.PlaceholderResolvercreated from the givenplaceholderResolverFactoryto 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 newStandardWriterResolverthat will use aPropertyPlaceholderHelper.PlaceholderResolvercreated from the givenplaceholderResolverFactoryto resolve any placeholders in theoperationName. Writers will use the givenencodingand, 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:WriterResolverReturns a writer that can be used to write the snippet with the given name for the operation with the given name.- Specified by:
resolvein 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
-