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(String type,
PayloadSubsectionExtractor<?> subsectionExtractor,
Map<String,Object> attributes)
Creates a new
AbstractBodySnippet that will produce a snippet named
<type>-body using a template named <type>-body. |
protected |
AbstractBodySnippet(String name,
String type,
PayloadSubsectionExtractor<?> subsectionExtractor,
Map<String,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 Map<String,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 MediaType |
getContentType(Operation operation)
Returns the content type of the request or response extracted from the given
operation. |
document, getAttributes, getSnippetNameprotected AbstractBodySnippet(String type, PayloadSubsectionExtractor<?> subsectionExtractor, Map<String,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(String name, String type, PayloadSubsectionExtractor<?> subsectionExtractor, Map<String,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 Map<String,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 IOException
operation.operation - The operationIOException - if the content cannot be extracted