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(java.lang.String type,
java.util.List<FieldDescriptor> descriptors,
java.util.Map<java.lang.String,java.lang.Object> attributes,
boolean ignoreUndocumentedFields)
Creates a new
AbstractFieldsSnippet that will produce a snippet named
<type>-fields using a template named <type>-fields. |
protected |
AbstractFieldsSnippet(java.lang.String type,
java.util.List<FieldDescriptor> descriptors,
java.util.Map<java.lang.String,java.lang.Object> attributes,
boolean ignoreUndocumentedFields,
PayloadSubsectionExtractor<?> subsectionExtractor)
Creates a new
AbstractFieldsSnippet that will produce a snippet named
<type>-fields using a template named <type>-fields. |
protected |
AbstractFieldsSnippet(java.lang.String name,
java.lang.String type,
java.util.List<FieldDescriptor> descriptors,
java.util.Map<java.lang.String,java.lang.Object> attributes,
boolean ignoreUndocumentedFields)
Creates a new
AbstractFieldsSnippet that will produce a snippet named
<name>-fields using a template named <type>-fields. |
protected |
AbstractFieldsSnippet(java.lang.String name,
java.lang.String type,
java.util.List<FieldDescriptor> descriptors,
java.util.Map<java.lang.String,java.lang.Object> attributes,
boolean ignoreUndocumentedFields,
PayloadSubsectionExtractor<?> subsectionExtractor)
Creates a new
AbstractFieldsSnippet that will produce a snippet named
<name>-fields using a template named <type>-fields. |
| 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(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 org.springframework.http.MediaType |
getContentType(Operation operation)
Returns the content type of the request or response extracted from the given
operation. |
protected java.util.List<FieldDescriptor> |
getFieldDescriptors()
Returns the list of
FieldDescriptors that will be used to
generate the documentation. |
protected boolean |
isIgnoredUndocumentedFields()
Returns whether or not this snippet ignores undocumented fields.
|
document, getAttributes, getSnippetNameprotected AbstractFieldsSnippet(java.lang.String type,
java.util.List<FieldDescriptor> descriptors,
java.util.Map<java.lang.String,java.lang.Object> attributes,
boolean ignoreUndocumentedFields)
AbstractFieldsSnippet that will produce a snippet named
<type>-fields using a template 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 AbstractFieldsSnippet(java.lang.String type,
java.util.List<FieldDescriptor> descriptors,
java.util.Map<java.lang.String,java.lang.Object> attributes,
boolean ignoreUndocumentedFields,
PayloadSubsectionExtractor<?> subsectionExtractor)
AbstractFieldsSnippet that will produce a snippet named
<type>-fields using a template named <type>-fields. The fields in
the subsection of the payload extracted by the given subsectionExtractor
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 ignoredsubsectionExtractor - the subsection extractorprotected AbstractFieldsSnippet(java.lang.String name,
java.lang.String type,
java.util.List<FieldDescriptor> descriptors,
java.util.Map<java.lang.String,java.lang.Object> attributes,
boolean ignoreUndocumentedFields)
AbstractFieldsSnippet that will produce a snippet named
<name>-fields using a template 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.name - the name of the snippettype - the type of the fieldsdescriptors - the field descriptorsattributes - the additional attributesignoreUndocumentedFields - whether undocumented fields should be ignoredprotected AbstractFieldsSnippet(java.lang.String name,
java.lang.String type,
java.util.List<FieldDescriptor> descriptors,
java.util.Map<java.lang.String,java.lang.Object> attributes,
boolean ignoreUndocumentedFields,
PayloadSubsectionExtractor<?> subsectionExtractor)
AbstractFieldsSnippet that will produce a snippet named
<name>-fields using a template named <type>-fields. The fields in
the subsection of the payload identified by subsectionPath 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.name - the name of the snippettype - the type of the fieldsdescriptors - the field descriptorsattributes - the additional attributesignoreUndocumentedFields - whether undocumented fields should be ignoredsubsectionExtractor - the subsection extractor documented. null or an
empty string can be used to indicate that the entire payload should be documented.protected 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 org.springframework.http.MediaType getContentType(Operation operation)
operation.operation - The operationprotected abstract byte[] getContent(Operation operation) throws java.io.IOException
operation.operation - The operationjava.io.IOException - if the content cannot be extractedprotected final java.util.List<FieldDescriptor> getFieldDescriptors()
FieldDescriptors that will be used to
generate the documentation.protected final boolean isIgnoredUndocumentedFields()
true if undocumented fields are ignored, otherwise falseprotected java.util.Map<java.lang.String,java.lang.Object> createModelForDescriptor(FieldDescriptor descriptor)
descriptor.descriptor - the descriptor