public abstract class AbstractFieldsSnippet extends TemplatedSnippet
TemplatedSnippet subclass that provides a base for snippets that
document a RESTful resource's request or response fields.| Modifier | Constructor and Description |
|---|---|
protected |
AbstractFieldsSnippet(String type,
List<FieldDescriptor> descriptors,
Map<String,Object> attributes)
Deprecated.
since 1.1 in favor of
AbstractFieldsSnippet(String, List, Map, boolean) |
protected |
AbstractFieldsSnippet(String type,
List<FieldDescriptor> descriptors,
Map<String,Object> attributes,
boolean ignoreUndocumentedFields)
Creates a new
AbstractFieldsSnippet that will produce a snippet named
<type>-fields. |
| Modifier and Type | Method and Description |
|---|---|
protected List<FieldDescriptor> |
applyPathPrefix(String pathPrefix,
List<FieldDescriptor> descriptors)
Creates a copy of the given
descriptors with the given pathPrefix
applied to their paths. |
protected Map<String,Object> |
createModel(Operation operation)
Create the model that should be used during template rendering to document the
given
operation. |
protected Map<String,Object> |
createModelForDescriptor(FieldDescriptor descriptor)
Returns a model for the given
descriptor. |
protected abstract byte[] |
getContent(Operation operation)
Returns the content of the request or response extracted form the given
operation. |
protected abstract MediaType |
getContentType(Operation operation)
Returns the content type of the request or response extracted from the given
operation. |
protected List<FieldDescriptor> |
getFieldDescriptors()
Returns the list of
FieldDescriptors that will be used to
generate the documentation. |
document, getAttributes, getSnippetName@Deprecated protected AbstractFieldsSnippet(String type, List<FieldDescriptor> descriptors, Map<String,Object> attributes)
AbstractFieldsSnippet(String, List, Map, boolean)AbstractFieldsSnippet that will produce a snippet named
<type>-fields. The fields will be documented using the given
descriptors and the given attributes will be included in the model
during template rendering. Undocumented fields will trigger a failure.type - the type of the fieldsdescriptors - the field descriptorsattributes - the additional attributesprotected AbstractFieldsSnippet(String type, List<FieldDescriptor> descriptors, Map<String,Object> attributes, boolean ignoreUndocumentedFields)
AbstractFieldsSnippet that will produce a snippet named
<type>-fields. The fields will be documented using the given
descriptors and the given attributes will be included in the model
during template rendering. If ignoreUndocumentedFields is true,
undocumented fields will be ignored and will not trigger a failure.type - the type of the fieldsdescriptors - the field descriptorsattributes - the additional attributesignoreUndocumentedFields - whether undocumented fields should be ignoredprotected 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 MediaType getContentType(Operation operation)
operation.operation - The operationprotected abstract byte[] getContent(Operation operation) throws IOException
operation.operation - The operationIOException - if the content cannot be extractedprotected final List<FieldDescriptor> getFieldDescriptors()
FieldDescriptors that will be used to
generate the documentation.protected Map<String,Object> createModelForDescriptor(FieldDescriptor descriptor)
descriptor.descriptor - the descriptorprotected final List<FieldDescriptor> applyPathPrefix(String pathPrefix, List<FieldDescriptor> descriptors)
descriptors with the given pathPrefix
applied to their paths.pathPrefix - the path prefixdescriptors - the descriptors to copy