Class StandardWriterResolver

java.lang.Object
org.springframework.restdocs.snippet.StandardWriterResolver
All Implemented Interfaces:
WriterResolver

public final class StandardWriterResolver extends Object implements WriterResolver
Standard implementation of WriterResolver.
Author:
Andy Wilkinson
  • Constructor Details

    • StandardWriterResolver

      public StandardWriterResolver(PlaceholderResolverFactory placeholderResolverFactory, String encoding, TemplateFormat templateFormat)
      Creates a new StandardWriterResolver that will use a PropertyPlaceholderHelper.PlaceholderResolver created from the given placeholderResolverFactory to resolve any placeholders in the operationName. Writers will use the given encoding and, when writing to a file, will use a filename appropriate for content generated from templates in the given templateFormat.
      Parameters:
      placeholderResolverFactory - the placeholder resolver factory
      encoding - the encoding
      templateFormat - 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 interface WriterResolver
      Parameters:
      operationName - the name of the operation that is being documented
      snippetName - the name of the snippet
      context - the current documentation context
      Returns:
      the writer
      Throws:
      IOException - if a writer cannot be resolved