public class RequestPartBodySnippet extends AbstractBodySnippet
Snippet
that documents the body of a request part.Constructor and Description |
---|
RequestPartBodySnippet(String partName)
Creates a new
RequestPartBodySnippet that will document the body of the
request part with the given partName . |
RequestPartBodySnippet(String partName,
Map<String,Object> attributes)
Creates a new
RequestPartBodySnippet that will document the body of the
request part with the given partName . |
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 . |
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 . |
Modifier and Type | Method and Description |
---|---|
protected byte[] |
getContent(Operation operation)
Returns the content of the request or response extracted from the given
operation . |
protected org.springframework.http.MediaType |
getContentType(Operation operation)
Returns the content type of the request or response extracted from the given
operation . |
createModel
document, getAttributes, getSnippetName
public RequestPartBodySnippet(String partName)
RequestPartBodySnippet
that will document the body of the
request part with the given partName
.partName
- the name of the request partpublic RequestPartBodySnippet(String partName, PayloadSubsectionExtractor<?> subsectionExtractor)
RequestPartBodySnippet
that will document the subsection of
the body of the request part with the given partName
extracted by the given
subsectionExtractor
.partName
- the name of the request partsubsectionExtractor
- the subsection extractorpublic RequestPartBodySnippet(String partName, Map<String,Object> attributes)
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.partName
- the name of the request partattributes
- the additional attributespublic RequestPartBodySnippet(String partName, PayloadSubsectionExtractor<?> subsectionExtractor, Map<String,Object> attributes)
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.partName
- the name of the request partsubsectionExtractor
- the subsection extractorattributes
- The additional attributesprotected byte[] getContent(Operation operation) throws IOException
AbstractBodySnippet
operation
.getContent
in class AbstractBodySnippet
operation
- The operationIOException
- if the content cannot be extractedprotected org.springframework.http.MediaType getContentType(Operation operation)
AbstractBodySnippet
operation
.getContentType
in class AbstractBodySnippet
operation
- The operation