Example usage for org.springframework.web.servlet.mvc.condition ParamsRequestCondition getExpressions

List of usage examples for org.springframework.web.servlet.mvc.condition ParamsRequestCondition getExpressions

Introduction

In this page you can find the example usage for org.springframework.web.servlet.mvc.condition ParamsRequestCondition getExpressions.

Prototype

public Set<NameValueExpression<String>> getExpressions() 

Source Link

Document

Return the contained request parameter expressions.

Usage

From source file:springfox.documentation.spring.web.readers.operation.OperationParameterRequestConditionReader.java

@Override
public void apply(OperationContext context) {
    ParamsRequestCondition paramsCondition = context.getRequestMappingInfo().getParamsCondition();
    List<Parameter> parameters = newArrayList();
    for (NameValueExpression<String> expression : paramsCondition.getExpressions()) {
        if (skipParameter(parameters, expression)) {
            continue;
        }//from  w ww .j  av  a2 s  .c  om

        String paramValue = expression.getValue();
        AllowableListValues allowableValues = null;
        if (!isNullOrEmpty(paramValue)) {
            allowableValues = new AllowableListValues(newArrayList(paramValue), "string");
        }
        Parameter parameter = new ParameterBuilder().name(expression.getName()).description(null)
                .defaultValue(paramValue).required(true).allowMultiple(false)
                .type(resolver.resolve(String.class)).modelRef(new ModelRef("string"))
                .allowableValues(allowableValues).parameterType("query").build();
        parameters.add(parameter);
    }
    context.operationBuilder().parameters(parameters);
}