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 . |
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 given attributes
will be included in the model
during rendering of the template.snippetName
- The name of the snippetattributes
- 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()