Class RequestPartBodySnippet

All Implemented Interfaces:
Snippet

public class RequestPartBodySnippet extends AbstractBodySnippet
A Snippet that documents the body of a request part.
Author:
Andy Wilkinson
  • Constructor Details

    • RequestPartBodySnippet

      public RequestPartBodySnippet(String partName)
      Creates a new RequestPartBodySnippet that will document the body of the request part with the given partName.
      Parameters:
      partName - the name of the request part
    • RequestPartBodySnippet

      public RequestPartBodySnippet(String partName, PayloadSubsectionExtractor<?> subsectionExtractor)
      Creates a new RequestPartBodySnippet that will document the subsection of the body of the request part with the given partName extracted by the given subsectionExtractor.
      Parameters:
      partName - the name of the request part
      subsectionExtractor - the subsection extractor
    • RequestPartBodySnippet

      public RequestPartBodySnippet(String partName, Map<String,Object> attributes)
      Creates a new RequestPartBodySnippet that will document the body of the request part with the given partName. The given additional attributes will be included in the model during template rendering.
      Parameters:
      partName - the name of the request part
      attributes - the additional attributes
    • RequestPartBodySnippet

      public RequestPartBodySnippet(String partName, PayloadSubsectionExtractor<?> subsectionExtractor, Map<String,Object> attributes)
      Creates a new RequestPartBodySnippet that will document the body of the request part with the given partName. The subsection of the body extracted by the given subsectionExtractor will be documented and the given additional attributes that will be included in the model during template rendering.
      Parameters:
      partName - the name of the request part
      subsectionExtractor - the subsection extractor
      attributes - the additional attributes
  • Method Details

    • getContent

      protected byte[] getContent(Operation operation) throws IOException
      Description copied from class: AbstractBodySnippet
      Returns the content of the request or response extracted from the given operation.
      Specified by:
      getContent in class AbstractBodySnippet
      Parameters:
      operation - the operation
      Returns:
      the content
      Throws:
      IOException - if the content cannot be extracted
    • getContentType

      protected org.springframework.http.MediaType getContentType(Operation operation)
      Description copied from class: AbstractBodySnippet
      Returns the content type of the request or response extracted from the given operation.
      Specified by:
      getContentType in class AbstractBodySnippet
      Parameters:
      operation - the operation
      Returns:
      the content type