public abstract class AbstractHeadersSnippet extends TemplatedSnippet
TemplatedSnippet subclass that provides a base for snippets that
document a RESTful resource's request or response headers.| Modifier | Constructor and Description |
|---|---|
protected |
AbstractHeadersSnippet(java.lang.String type,
java.util.List<HeaderDescriptor> descriptors,
java.util.Map<java.lang.String,java.lang.Object> attributes)
Creates a new
AbstractHeadersSnippet that will produce a snippet named
<type>-headers. |
| 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 java.util.Map<java.lang.String,java.lang.Object> |
createModelForDescriptor(HeaderDescriptor descriptor)
Returns a model for the given
descriptor. |
protected abstract java.util.Set<java.lang.String> |
extractActualHeaders(Operation operation)
Extracts the names of the headers from the request or response of the given
operation. |
protected java.util.List<HeaderDescriptor> |
findMissingHeaders(Operation operation)
Finds the headers that are missing from the operation.
|
protected java.util.List<HeaderDescriptor> |
getHeaderDescriptors()
Returns the list of
HeaderDescriptors that will be used to
generate the documentation. |
document, getAttributes, getSnippetNameprotected AbstractHeadersSnippet(java.lang.String type,
java.util.List<HeaderDescriptor> descriptors,
java.util.Map<java.lang.String,java.lang.Object> attributes)
AbstractHeadersSnippet that will produce a snippet named
<type>-headers. The headers will be documented using the given
descriptors and the given attributes will be included in the model
during template rendering.type - the type of the headersdescriptors - the header descriptorsattributes - the additional 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 java.util.List<HeaderDescriptor> findMissingHeaders(Operation operation)
headerDescriptors but is not present in the
operation.operation - the operationprotected abstract java.util.Set<java.lang.String> extractActualHeaders(Operation operation)
operation.operation - the operationprotected final java.util.List<HeaderDescriptor> getHeaderDescriptors()
HeaderDescriptors that will be used to
generate the documentation.protected java.util.Map<java.lang.String,java.lang.Object> createModelForDescriptor(HeaderDescriptor descriptor)
descriptor.descriptor - the descriptor