Class SnippetConfigurer<PARENT,TYPE>
java.lang.Object
org.springframework.restdocs.config.AbstractConfigurer
org.springframework.restdocs.config.AbstractNestedConfigurer<PARENT>
org.springframework.restdocs.config.SnippetConfigurer<PARENT,TYPE>
- Type Parameters:
PARENT- the type of the configurer's parentTYPE- the concrete type of the configurer to be returned from chained methods
- Direct Known Subclasses:
MockMvcSnippetConfigurer,RestAssuredSnippetConfigurer,WebTestClientSnippetConfigurer
A configurer that can be used to configure the generated documentation snippets.
- Since:
- 1.1.0
- Author:
- Andy Wilkinson
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringThe default encoding for documentation snippets.static final TemplateFormatThe default format for documentation snippets. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedSnippetConfigurer(PARENT parent) Creates a newSnippetConfigurerwith the givenparent. -
Method Summary
Modifier and TypeMethodDescriptionvoidapply(Map<String, Object> configuration, RestDocumentationContext context) Applies the configurer to the givenconfiguration.withAdditionalDefaults(Snippet... additionalDefaultSnippets) Configures additional documentation snippets that will be produced by default.withDefaults(Snippet... defaultSnippets) Configures the documentation snippets that will be produced by default.withEncoding(String encoding) Configures any documentation snippets to be written using the givenencoding.withTemplateFormat(TemplateFormat format) Configures the format of the documentation snippet templates.Methods inherited from class org.springframework.restdocs.config.AbstractNestedConfigurer
and
-
Field Details
-
DEFAULT_SNIPPET_ENCODING
The default encoding for documentation snippets.- See Also:
-
DEFAULT_TEMPLATE_FORMAT
The default format for documentation snippets.- See Also:
-
-
Constructor Details
-
SnippetConfigurer
Creates a newSnippetConfigurerwith the givenparent.- Parameters:
parent- the parent
-
-
Method Details
-
apply
Description copied from class:AbstractConfigurerApplies the configurer to the givenconfiguration.- Specified by:
applyin classAbstractConfigurer- Parameters:
configuration- the configuration to be configuredcontext- the current documentation context
-
withEncoding
Configures any documentation snippets to be written using the givenencoding. The default is UTF-8.- Parameters:
encoding- the encoding- Returns:
this
-
withDefaults
Configures the documentation snippets that will be produced by default.- Parameters:
defaultSnippets- the default snippets- Returns:
this- See Also:
-
withAdditionalDefaults
Configures additional documentation snippets that will be produced by default.- Parameters:
additionalDefaultSnippets- the additional default snippets- Returns:
this- See Also:
-
withTemplateFormat
Configures the format of the documentation snippet templates.- Parameters:
format- the snippet template format- Returns:
this
-