Example usage for org.springframework.restdocs.operation OperationRequestPart getName

List of usage examples for org.springframework.restdocs.operation OperationRequestPart getName

Introduction

In this page you can find the example usage for org.springframework.restdocs.operation OperationRequestPart getName.

Prototype

String getName();

Source Link

Document

Returns the name of the part.

Usage

From source file:io.github.restdocsext.jersey.operation.preprocess.BinaryPartPlaceholderOperationPreprocessorTest.java

private boolean hasPart(Collection<OperationRequestPart> parts, String name, String content) {
    for (OperationRequestPart part : parts) {
        if (name.equals(part.getName()) && content.equals(part.getContentAsString())) {
            return true;
        }/*from w  w w . ja  v  a  2 s.  co m*/
    }
    return false;
}

From source file:io.github.restdocsext.jersey.JerseyRequestConverterTest.java

private boolean hasPart(List<OperationRequestPart> parts, String name, String content) {
    for (OperationRequestPart part : parts) {
        if (name.equals(part.getName()) && content.equals(part.getContentAsString())) {
            return true;
        }/*w  ww  . java  2s . c o  m*/
    }
    return false;
}

From source file:io.github.restdocsext.jersey.operation.preprocess.BinaryPartPlaceholderOperationPreprocessor.java

private Collection<OperationRequestPart> modifyParts(Collection<OperationRequestPart> parts) {
    final List<OperationRequestPart> modifiedParts = new ArrayList<>();
    for (OperationRequestPart part : parts) {
        boolean foundField = false;
        for (MultiPartField field : this.fields) {
            if (field.getName().equals(part.getName())) {
                final OperationRequestPart modifiedPart = modifyPart(part, field);
                modifiedParts.add(modifiedPart);
                foundField = true;//from  ww w .j ava2 s. c om
                break;
            }
        }
        if (!foundField) {
            modifiedParts.add(part);
        }
    }
    return modifiedParts;
}