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:
@@ -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}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user