public abstract class AbstractBodySnippet extends TemplatedSnippet
TemplatedSnippet subclass that provides a base for snippets that
document a RESTful resource's request or response body.| Modifier | Constructor and Description |
|---|---|
protected |
AbstractBodySnippet(java.lang.String type,
PayloadSubsectionExtractor<?> subsectionExtractor,
java.util.Map<java.lang.String,java.lang.Object> attributes)
Creates a new
AbstractBodySnippet that will produce a snippet named
<type>-body using a template named <type>-body. |
protected |
AbstractBodySnippet(java.lang.String name,
java.lang.String type,
PayloadSubsectionExtractor<?> subsectionExtractor,
java.util.Map<java.lang.String,java.lang.Object> attributes)
Creates a new
AbstractBodySnippet that will produce a snippet named
<name>-body using a template named <type>-body. |
| Modifier and Type | Method and Description |
|---|---|
protected java.util.Map<java.lang.String,java.lang.Object> |
createModel(Operation operation)
Create the model that should be used during template rendering to document the
given
operation. |
protected abstract byte[] |
getContent(Operation operation)
Returns the content of the request or response extracted from the given
operation. |
protected abstract org.springframework.http.MediaType |
getContentType(Operation operation)
Returns the content type of the request or response extracted from the given
operation. |
document, getAttributes, getSnippetNameprotected AbstractBodySnippet(java.lang.String type,
PayloadSubsectionExtractor<?> subsectionExtractor,
java.util.Map<java.lang.String,java.lang.Object> attributes)
AbstractBodySnippet that will produce a snippet named
<type>-body using a template named <type>-body. The snippet will
contain the subsection of the body extracted by the given
subsectionExtractor. The given attributes will be included in the
model during template renderingtype - the type of the bodysubsectionExtractor - the subsection extractorattributes - the attributesprotected AbstractBodySnippet(java.lang.String name,
java.lang.String type,
PayloadSubsectionExtractor<?> subsectionExtractor,
java.util.Map<java.lang.String,java.lang.Object> attributes)
AbstractBodySnippet that will produce a snippet named
<name>-body using a template named <type>-body. The snippet will
contain the subsection of the body extracted by the given
subsectionExtractor. The given attributes will be included in the
model during template renderingname - the name of the snippettype - the type of the bodysubsectionExtractor - the subsection extractorattributes - the attributesprotected java.util.Map<java.lang.String,java.lang.Object> createModel(Operation operation)
TemplatedSnippetoperation. Any additional attributes that were supplied when this
TemplatedSnippet were created will be automatically added to the model
prior to rendering.createModel in class TemplatedSnippetoperation - The operationprotected abstract byte[] getContent(Operation operation) throws java.io.IOException
operation.operation - The operationjava.io.IOException - if the content cannot be extractedprotected abstract org.springframework.http.MediaType getContentType(Operation operation)
operation.operation - The operation