Make ContentModifier part of the public API

Previously, ContentModifier and ContentModifyingOperationPreprocessor
were package-private. This meant that anyone wishing to perform content
modification during preprocessing had to reimplement much of the
existing content modifying preprocessor, that than just having to
implement ContentModifier.

This commits make both ContentModifier and
ContentModifyingOperationPreprocessor public so that all custom
content modification is now a matter of implementing a custom
ContentModifier and creating an instance of
ContentModifyingOperationPreprocessor.

Closes gh-121
This commit is contained in:
Andy Wilkinson
2015-09-13 16:02:19 +01:00
parent dc9af9599e
commit ebab967e43
2 changed files with 9 additions and 3 deletions

View File

@@ -27,7 +27,7 @@ import org.springframework.restdocs.operation.OperationResponse;
* @author Andy Wilkinson
* @see ContentModifyingOperationPreprocessor
*/
interface ContentModifier {
public interface ContentModifier {
/**
* Returns modified content based on the given {@code originalContent}

View File

@@ -28,11 +28,17 @@ import org.springframework.restdocs.operation.StandardOperationResponse;
*
* @author Andy Wilkinson
*/
class ContentModifyingOperationPreprocessor implements OperationPreprocessor {
public class ContentModifyingOperationPreprocessor implements OperationPreprocessor {
private final ContentModifier contentModifier;
ContentModifyingOperationPreprocessor(ContentModifier contentModifier) {
/**
* Create a new {@code ContentModifyingOperationPreprocessor} that will apply the
* given {@code contentModifier} to the operation's request or response.
*
* @param contentModifier the contentModifier
*/
public ContentModifyingOperationPreprocessor(ContentModifier contentModifier) {
this.contentModifier = contentModifier;
}