@Override public boolean isAllowMultiple() { return apiParam.allowMultiple(); }
@Override public void apply(ParameterContext context) { Optional<ApiParam> apiParam = context.resolvedMethodParameter().findAnnotation(ApiParam.class); context.parameterBuilder() .allowableValues(allowableValues( context.alternateFor(context.resolvedMethodParameter().getParameterType()), apiParam.transform(toAllowableValue()).or(""))); if (apiParam.isPresent()) { ApiParam annotation = apiParam.get(); context.parameterBuilder().name(emptyToNull(annotation.name())) .description(emptyToNull(descriptions.resolve(annotation.value()))) .parameterAccess(emptyToNull(annotation.access())) .defaultValue(emptyToNull(annotation.defaultValue())) .allowMultiple(annotation.allowMultiple()) .allowEmptyValue(annotation.allowEmptyValue()) .required(annotation.required()) .scalarExample(new Example(annotation.example())) .complexExamples(examples(annotation.examples())) .hidden(annotation.hidden()) .collectionFormat(annotation.collectionFormat()) .order(SWAGGER_PLUGIN_ORDER); } }
private void fromApiParam(ParameterExpansionContext context, ApiParam apiParam) { String allowableProperty = emptyToNull(apiParam.allowableValues()); AllowableValues allowable = allowableValues( fromNullable(allowableProperty), context.getFieldType().getErasedType()); maybeSetParameterName(context, apiParam.name()) .description(descriptions.resolve(apiParam.value())) .defaultValue(apiParam.defaultValue()) .required(apiParam.required()) .allowMultiple(apiParam.allowMultiple()) .allowableValues(allowable) .parameterAccess(apiParam.access()) .hidden(apiParam.hidden()) .scalarExample(apiParam.example()) .complexExamples(examples(apiParam.examples())) .order(SWAGGER_PLUGIN_ORDER) .build(); }