public abstract class TemplatedSnippet extends Object implements Snippet
Modifier | Constructor and Description |
---|---|
protected |
TemplatedSnippet(String snippetName,
Map<String,Object> attributes)
Creates a new
TemplatedSnippet that will produce a snippet with the given
snippetName . |
protected |
TemplatedSnippet(String snippetName,
String templateName,
Map<String,Object> attributes)
Creates a new
TemplatedSnippet that will produce a snippet with the given
snippetName using a template with the given templateName . |
Modifier and Type | Method and Description |
---|---|
protected abstract Map<String,Object> |
createModel(Operation operation)
Create the model that should be used during template rendering to document the
given
operation . |
void |
document(Operation operation)
Documents the call to the RESTful API described by the given
operation . |
protected Map<String,Object> |
getAttributes()
Returns the additional attributes that will be included in the model during
template rendering.
|
protected String |
getSnippetName()
Returns the name of the snippet that will be created.
|
protected TemplatedSnippet(String snippetName, Map<String,Object> attributes)
TemplatedSnippet
that will produce a snippet with the given
snippetName
. The snippetName
will also be used as the name of the
template. The given attributes
will be included in the model during
rendering of the template.snippetName
- the name of the snippetattributes
- the additional attributesTemplatedSnippet(String, String, Map)
protected TemplatedSnippet(String snippetName, String templateName, Map<String,Object> attributes)
TemplatedSnippet
that will produce a snippet with the given
snippetName
using a template with the given templateName
. The given
attributes
will be included in the model during rendering of the template.snippetName
- the name of the snippettemplateName
- the name of the templateattributes
- the additional attributespublic void document(Operation operation) throws IOException
Snippet
operation
.document
in interface Snippet
operation
- the API operationIOException
- if a failure occurs will documenting the operationprotected abstract Map<String,Object> createModel(Operation operation)
operation
. Any additional attributes that were supplied when this
TemplatedSnippet
were created will be automatically added to the model
prior to rendering.operation
- the operationModelCreationException
- if model creation failsprotected final Map<String,Object> getAttributes()
protected final String getSnippetName()