springfox.documentation.spi.service.contexts.ParameterContext Java Examples

The following examples show how to use springfox.documentation.spi.service.contexts.ParameterContext. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source Project: swagger-more   Author: uhfun   File: ApiParamReader.java    License: Apache License 2.0 6 votes vote down vote up
@Override
public void apply(ParameterContext context) {
    ResolvedType resolvedType = context.resolvedMethodParameter().getParameterType();
    Class erasedType = resolvedType.getErasedType();
    if (isGeneratedType(erasedType)) {
        context.parameterBuilder()
                .parameterType("body").name(erasedType.getSimpleName())
                .description("Not a real parameter, it is a parameter generated after assembly.");
        return;
    }
    Optional<ApiParam> optional = readApiParam(context);
    if (optional.isPresent()) {
        ApiParam apiParam = optional.get();
        List<VendorExtension> extensions = buildExtensions(resolvedType);
        context.parameterBuilder().name(emptyToNull(apiParam.name()))
                .description(emptyToNull(resolver.resolve(apiParam.value())))
                .parameterType(TypeUtils.isComplexObjectType(erasedType) ? "body" : "query")
                .order(SWAGGER_PLUGIN_ORDER)
                .hidden(false)
                .parameterAccess(emptyToNull(apiParam.access()))
                .defaultValue(emptyToNull(apiParam.defaultValue()))
                .allowMultiple(apiParam.allowMultiple())
                .allowEmptyValue(apiParam.allowEmptyValue())
                .required(apiParam.required())
                .scalarExample(new Example(apiParam.example()))
                .complexExamples(examples(apiParam.examples()))
                .collectionFormat(apiParam.collectionFormat())
                .vendorExtensions(extensions);
    }
}
 
Example #2
Source Project: jframework   Author: micro-jframework   File: ApiRefererParameterReader.java    License: Apache License 2.0 6 votes vote down vote up
@Override
public void apply(ParameterContext context) {
    ApiReferer apiReferer = context.getOperationContext().findAnnotation(ApiReferer.class).orNull();
    if (ObjectUtils.isEmpty(apiReferer)) {
        return;
    }
    String filedName = context.resolvedMethodParameter().defaultName().orNull();
    if (ObjectUtils.isEmpty(filedName)) {
        return;
    }
    try {
        String apimodelPropertyValue = apiReferer.value().getDeclaredField(filedName).getAnnotation(ApiModelProperty.class).value();
        context.parameterBuilder().description(apimodelPropertyValue);
    } catch (Exception e) {
        log.debug("apiReferer get filed error ", e);
    }
}
 
Example #3
Source Project: stategen   Author: stategen   File: ApiParamParameterBuilder.java    License: GNU Affero General Public License v3.0 6 votes vote down vote up
@Override
public void apply(ParameterContext context) {
  MethodParameter methodParameter = context.methodParameter();
  Optional<ApiParam> apiParam = findApiParam(methodParameter);
  context.parameterBuilder()
      .allowableValues(allowableValues(
          methodParameter,
          apiParam.transform(toAllowableValue()).or("")));
  if (apiParam.isPresent()) {
      Optional<ResolvedType> typeOptional = context.parameterBuilder().build().getType();
      ResolvedType resolvedType = typeOptional.get();
      String enumDescs = EnumUtil.getDescIfIsEnum(resolvedType);
    context.parameterBuilder().name(emptyToNull(apiParam.get().name()));
    if (StringUtil.isNotEmpty(enumDescs)){
        context.parameterBuilder().description(emptyToNull(apiParam.get().value()+":"+enumDescs));
    } else {
        context.parameterBuilder().description(emptyToNull(apiParam.get().value()));
    }
    context.parameterBuilder().parameterAccess(emptyToNull(apiParam.get().access()));
    context.parameterBuilder().defaultValue(emptyToNull(apiParam.get().defaultValue()));
    context.parameterBuilder().allowMultiple(apiParam.get().allowMultiple());
    context.parameterBuilder().required(apiParam.get().required());
  }
}
 
Example #4
Source Project: springfox-javadoc   Author: springfox   File: JavadocBuilderPlugin.java    License: Apache License 2.0 6 votes vote down vote up
@Override
public void apply(ParameterContext context) {
    String description = null;
    Optional<String> parmName = context.resolvedMethodParameter().defaultName();
    Annotation apiParam = annotationFromField(context, API_PARAM);
    if (apiParam != null) {
        Optional<Boolean> isRequired = isParamRequired(apiParam, context);
        if (isRequired.isPresent()) {
            context.parameterBuilder().required(isRequired.get());
        }
    }
    if (parmName.isPresent() && (apiParam == null || !hasValue(apiParam, context))) {
        String key = context.getOperationContext().requestMappingPattern() + PERIOD
          + context.getOperationContext().httpMethod().name() + ".param." + parmName.get();
        description = environment.getProperty(key);
    }
    if (description != null) {
        context.parameterBuilder().description(description);
    }
}
 
Example #5
Source Project: BlogManagePlatform   Author: Frodez   File: DefaultParamPlugin.java    License: Apache License 2.0 6 votes vote down vote up
private void resolveApiParam(ParameterContext context) {
	ResolvedType resolvedType = context.resolvedMethodParameter().getParameterType();
	Class<?> parameterClass = resolveParamType(resolvedType);
	if (parameterClass == null) {
		log.warn(StrUtil.concat(resolvedType.getBriefDescription(), "的类型无法被DefaultParamPlugin解析"));
		@SuppressWarnings("unused") int a = 1;
		return;
	}
	ApiModel apiModel = parameterClass.getAnnotation(ApiModel.class);
	if (apiModel == null) {
		if (!BeanUtils.isSimpleProperty(parameterClass)) {
			warn(context, parameterClass);
		}
		return;
	}
	ParameterBuilder builder = context.parameterBuilder();
	builder.name(apiModel.description());
	builder.description(descriptions.resolve(apiModel.description()));
	builder.allowMultiple(false);
	builder.allowEmptyValue(false);
	builder.hidden(false);
	builder.collectionFormat("");
	builder.order(SWAGGER_PLUGIN_ORDER);
}
 
Example #6
Source Project: jhipster   Author: jhipster   File: PageableParameterBuilderPlugin.java    License: Apache License 2.0 6 votes vote down vote up
/** {@inheritDoc} */
@Override
public void apply(OperationContext context) {
    List<Parameter> parameters = newArrayList();
    for (ResolvedMethodParameter methodParameter : context.getParameters()) {
        ResolvedType resolvedType = methodParameter.getParameterType();

        if (pageableType.equals(resolvedType)) {
            ParameterContext parameterContext = new ParameterContext(methodParameter,
                new ParameterBuilder(),
                context.getDocumentationContext(),
                context.getGenericsNamingStrategy(),
                context);

            parameters.add(createPageParameter(parameterContext));
            parameters.add(createSizeParameter(parameterContext));
            parameters.add(createSortParameter(parameterContext));

            context.operationBuilder().parameters(parameters);
        }
    }
}
 
Example #7
Source Project: swagger-more   Author: uhfun   File: ApiParamReader.java    License: Apache License 2.0 5 votes vote down vote up
private Optional<ApiParam> readApiParam(ParameterContext context) {
    Optional<ApiMethod> optional = context.getOperationContext().findAnnotation(ApiMethod.class);
    if (optional.isPresent()) {
        ApiMethod apiMethod = optional.get();
        ResolvedMethodParameter parameter = context.resolvedMethodParameter();
        if (parameter.getParameterIndex() > apiMethod.params().length - 1) {
            throw new SwaggerMoreException("The number of parameters in method " + context.getOperationContext().getName() + " does not match the number of @ApiParam.");
        }
        return Optional.of(apiMethod.params()[parameter.getParameterIndex()]);
    }
    return Optional.absent();
}
 
Example #8
Source Project: openapi-generator   Author: OpenAPITools   File: ParameterAllowableValuesPlugin.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public void apply(ParameterContext parameterContext) {
    String name = parameterContext.getOperationContext().getName();
    switch (name) {
        case "getClientOptions":
        case "generateClient":
            parameterContext.parameterBuilder().allowableValues(new AllowableListValues(clients, "string"));
            break;
        case "getServerOptions":
        case "generateServerForLanguage":
            parameterContext.parameterBuilder().allowableValues(new AllowableListValues(servers, "string"));
    }
}
 
Example #9
Source Project: springfox-javadoc   Author: springfox   File: JavadocBuilderPlugin.java    License: Apache License 2.0 5 votes vote down vote up
private static Annotation annotationFromField(ParameterContext context, String annotationType) {

        ResolvedMethodParameter methodParam = context.resolvedMethodParameter();

        for (Annotation annotation : methodParam.getAnnotations()) {
            if (annotation.annotationType().getName().equals(annotationType)) {
                return annotation;
            }
        }
        return null;

    }
 
Example #10
Source Project: springfox-javadoc   Author: springfox   File: JavadocBuilderPlugin.java    License: Apache License 2.0 5 votes vote down vote up
@VisibleForTesting
Optional<Boolean> isParamRequired(Annotation apiParam, ParameterContext context) {
    if (apiParam != null) {
        Optional<Boolean> required = isRequired(apiParam, context);
        if (required.isPresent()) {
            return required;
        }
    }
    Annotation annotation = annotationFromField(context, REQUEST_PARAM);
    if (annotation == null) {
        annotation = annotationFromField(context, PATH_VARIABLE);
    }
    return annotation != null ? isRequired(annotation, context) : Optional.<Boolean>absent();
}
 
Example #11
Source Project: springfox-javadoc   Author: springfox   File: JavadocBuilderPlugin.java    License: Apache License 2.0 5 votes vote down vote up
@VisibleForTesting
Optional<Boolean> isRequired(Annotation annotation, ParameterContext context) {
    for (Method method : annotation.annotationType().getDeclaredMethods()) {
        if (method.getName().equals("required")) {
            try {
                return Optional.of((Boolean) method.invoke(annotation, (Object) null));
            } catch (Exception ex) {
                return Optional.absent();
            }
        }
    }
    return Optional.absent();
}
 
Example #12
Source Project: springfox-javadoc   Author: springfox   File: JavadocBuilderPlugin.java    License: Apache License 2.0 5 votes vote down vote up
@VisibleForTesting
boolean hasValue(Annotation annotation, ParameterContext context) {
    for (Method method : annotation.annotationType().getDeclaredMethods()) {
        if (method.getName().equals("value")) {
            try {
                Optional<String> value = Optional.of((String) method.invoke(annotation, (Object) null));
                return value.isPresent();
            } catch (Exception ex) {
                return false;
            }
        }
    }
    return false;
}
 
Example #13
Source Project: spring-cloud-gray   Author: SpringCloud   File: PageableParameterBuilderPlugin.java    License: Apache License 2.0 5 votes vote down vote up
private Function<ResolvedType, ? extends ModelReference> createModelRefFactory(ParameterContext context) {
    ModelContext modelContext = inputParam(
            context.getGroupName(),
            context.resolvedMethodParameter().getParameterType(),
            context.getDocumentationType(),
            context.getAlternateTypeProvider(),
            context.getGenericNamingStrategy(),
            context.getIgnorableParameterTypes());
    return ResolvedTypes.modelRefFactory(modelContext, nameExtractor);
}
 
Example #14
Source Project: BlogManagePlatform   Author: Frodez   File: DefaultParamPlugin.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public void apply(ParameterContext context) {
	resolveParameterType(context);
	if (context.resolvedMethodParameter().hasParameterAnnotation(ApiParam.class)) {
		return;
	}
	resolveMapEnum(context);
	resolveApiParam(context);
}
 
Example #15
Source Project: BlogManagePlatform   Author: Frodez   File: DefaultParamPlugin.java    License: Apache License 2.0 5 votes vote down vote up
@SneakyThrows
private void resolveMapEnum(ParameterContext context) {
	MapEnum enumParam = context.resolvedMethodParameter().findAnnotation(MapEnum.class).orNull();
	if (enumParam != null) {
		String descs = MapEnumHelper.getDescs(enumParam.value(), enumParam.descMethod());
		Object defaultValue = MapEnumHelper.getDefaultValue(enumParam.value());
		ParameterBuilder builder = context.parameterBuilder();
		builder.description(descs);
		builder.scalarExample(new Example(defaultValue == null ? DefStr.EMPTY : defaultValue.toString()));
		builder.allowableValues(MapEnumHelper.getAllowableValues(enumParam.value()));
		builder.defaultValue(defaultValue == null ? DefStr.EMPTY : defaultValue.toString());
	}
}
 
Example #16
Source Project: albedo   Author: somowhere   File: PageableParameterBuilderPlugin.java    License: GNU Lesser General Public License v3.0 5 votes vote down vote up
protected Function<ResolvedType, ? extends ModelReference> createModelRefFactory(ParameterContext context) {
	ModelContext modelContext = inputParam(
		context.getGroupName(),
		context.resolvedMethodParameter().getParameterType(),
		context.getDocumentationType(),
		context.getAlternateTypeProvider(),
		context.getGenericNamingStrategy(),
		context.getIgnorableParameterTypes());
	return (Function<ResolvedType, ? extends ModelReference>) modelRefFactory(modelContext, nameExtractor);
}
 
Example #17
Source Project: albedo   Author: somowhere   File: PageableParameterBuilderPlugin.java    License: GNU Lesser General Public License v3.0 5 votes vote down vote up
@Override
public void apply(OperationContext context) {
	for (ResolvedMethodParameter methodParameter : context.getParameters()) {
		ResolvedType resolvedType = methodParameter.getParameterType();
		if (pageableType.equals(resolvedType)) {
			ParameterContext parameterContext = new ParameterContext(methodParameter,
				new ParameterBuilder(),
				context.getDocumentationContext(),
				context.getGenericsNamingStrategy(),
				context);

			ModelReference intModel = createModelRefFactory(parameterContext).apply(resolver.resolve(Integer.TYPE));
			ModelReference stringModel = createModelRefFactory(parameterContext).apply(resolver.resolve(List.class, String.class));

			List<Parameter> parameters = Lists.newArrayList(
				new ParameterBuilder()
					.parameterType("query").name("current").modelRef(intModel)
					.description("Page number of the requested page")
					.build(),
				new ParameterBuilder()
					.parameterType("query").name("size").modelRef(intModel)
					.description("Size of a page")
					.build(),
				new ParameterBuilder()
					.parameterType("query").name("descs").modelRef(stringModel).allowMultiple(true)
					.description("Sorting criteria in the format: property(,asc|desc). Default sort order is ascending. Multiple sort criteria are supported.")
					.build(),
				new ParameterBuilder()
					.parameterType("query").name("ascs").modelRef(stringModel).allowMultiple(true)
					.description("Sorting criteria in the format: property(,asc|desc). Default sort order is ascending. Multiple sort criteria are supported.")
					.build(),
				new ParameterBuilder()
					.parameterType("query").name("queryConditionJson").modelRef(stringModel).allowMultiple(true)
					.description("search json [{\"fieldName\":\"name\",\"attrType\":\"String\",\"fieldNode\":\"\",\"operate\":\"like\",\"weight\":0,\"value\":\"g\"},{\"fieldName\":\"status\",\"attrType\":\"Integer\",\"fieldNode\":\"\",\"operate\":\"in\",\"weight\":0,\"value\":\"-1\"}]}")
					.build());

			context.operationBuilder().parameters(parameters);
		}
	}
}
 
Example #18
Source Project: Resource   Author: lovelifeming   File: ParametersReader.java    License: GNU General Public License v3.0 5 votes vote down vote up
private Function<ResolvedType, ? extends ModelReference> createModelRefFactory(ParameterContext context)
{
    ModelContext modelContext = inputParam(
        context.getGroupName(),
        context.resolvedMethodParameter().getParameterType(),
        context.getDocumentationType(),
        context.getAlternateTypeProvider(),
        context.getGenericNamingStrategy(),
        context.getIgnorableParameterTypes());
    return ResolvedTypes.modelRefFactory(modelContext, nameExtractor);
}
 
Example #19
Source Project: jhipster   Author: jhipster   File: PageableParameterBuilderPlugin.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Create a page parameter.
 * Override it if needed. Set a default value for example.
 *
 * @param context {@link org.springframework.data.domain.Pageable} parameter context
 * @return The page parameter
 */
protected Parameter createPageParameter(ParameterContext context) {
    ModelReference intModel = createModelRefFactory(context).apply(resolver.resolve(Integer.TYPE));
    return new ParameterBuilder()
        .name(getPageName())
        .parameterType(PAGE_TYPE)
        .modelRef(intModel)
        .description(PAGE_DESCRIPTION)
        .build();
}
 
Example #20
Source Project: jhipster   Author: jhipster   File: PageableParameterBuilderPlugin.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Create a size parameter.
 * Override it if needed. Set a default value for example.
 *
 * @param context {@link org.springframework.data.domain.Pageable} parameter context
 * @return The size parameter
 */
protected Parameter createSizeParameter(ParameterContext context) {
    ModelReference intModel = createModelRefFactory(context).apply(resolver.resolve(Integer.TYPE));
    return new ParameterBuilder()
        .name(getSizeName())
        .parameterType(SIZE_TYPE)
        .modelRef(intModel)
        .description(SIZE_DESCRIPTION)
        .build();
}
 
Example #21
Source Project: jhipster   Author: jhipster   File: PageableParameterBuilderPlugin.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Create a sort parameter.
 * Override it if needed. Set a default value or further description for example.
 *
 * @param context {@link org.springframework.data.domain.Pageable} parameter context
 * @return The sort parameter
 */
protected Parameter createSortParameter(ParameterContext context) {
    ModelReference stringModel = createModelRefFactory(context).apply(resolver.resolve(List.class, String.class));
    return new ParameterBuilder()
        .name(getSortName())
        .parameterType(SORT_TYPE)
        .modelRef(stringModel)
        .allowMultiple(true)
        .description(SORT_DESCRIPTION)
        .build();
}
 
Example #22
Source Project: jhipster   Author: jhipster   File: PageableParameterBuilderPlugin.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * <p>createModelRefFactory.</p>
 *
 * @param context a {@link springfox.documentation.spi.service.contexts.ParameterContext} object.
 * @return a {@link java.util.function.Function} object.
 */
protected Function<ResolvedType, ? extends ModelReference> createModelRefFactory(ParameterContext context) {
    ModelContext modelContext = inputParam(
        context.getGroupName(),
        context.resolvedMethodParameter().getParameterType(),
        context.getDocumentationType(),
        context.getAlternateTypeProvider(),
        context.getGenericNamingStrategy(),
        context.getIgnorableParameterTypes());
    return modelRefFactory(modelContext, nameExtractor);
}
 
Example #23
Source Project: spring-cloud-gray   Author: SpringCloud   File: PageableParameterBuilderPlugin.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public void apply(OperationContext context) {
    List<ResolvedMethodParameter> methodParameters = context.getParameters();
    List<Parameter> parameters = newArrayList();

    for (ResolvedMethodParameter methodParameter : methodParameters) {
        ResolvedType resolvedType = methodParameter.getParameterType();

        if (pageableType.equals(resolvedType)) {
            ParameterContext parameterContext = new ParameterContext(methodParameter,
                    new ParameterBuilder(),
                    context.getDocumentationContext(),
                    context.getGenericsNamingStrategy(),
                    context);
            Function<ResolvedType, ? extends ModelReference> factory = createModelRefFactory(parameterContext);

            ModelReference intModel = factory.apply(resolver.resolve(Integer.TYPE));
            ModelReference stringModel = factory.apply(resolver.resolve(List.class, String.class));

            parameters.add(new ParameterBuilder()
                    .parameterType("queryRecords")
                    .name("page")
                    .modelRef(intModel)
                    .description("Results page you want to retrieve (0..N)").build());
            parameters.add(new ParameterBuilder()
                    .parameterType("queryRecords")
                    .name("size")
                    .modelRef(intModel)
                    .description("Number of records per page").build());
            parameters.add(new ParameterBuilder()
                    .parameterType("queryRecords")
                    .name("sort")
                    .modelRef(stringModel)
                    .allowMultiple(true)
                    .description("Sorting criteria in the format: property(,asc|desc). "
                            + "Default sort order is ascending. "
                            + "Multiple sort criteria are supported.")
                    .build());
            context.operationBuilder().parameters(parameters);
        }
    }
}
 
Example #24
Source Project: BlogManagePlatform   Author: Frodez   File: DefaultParamPlugin.java    License: Apache License 2.0 4 votes vote down vote up
private void resolveParameterType(ParameterContext context) {
	ResolvedMethodParameter parameter = context.resolvedMethodParameter();
	ResolvedType type = context.alternateFor(parameter.getParameterType());
	//Multi-part file trumps any other annotations
	if (isFileType(type) || isListOfFiles(type)) {
		context.parameterBuilder().parameterType("form");
		return;
	}
	if (parameter.hasParameterAnnotation(PathVariable.class)) {
		context.parameterBuilder().parameterType("path");
		return;
	}
	if (parameter.hasParameterAnnotation(RequestBody.class)) {
		context.parameterBuilder().parameterType("body");
		return;
	}
	if (parameter.hasParameterAnnotation(RequestPart.class)) {
		context.parameterBuilder().parameterType("formData");
		return;
	}
	if (parameter.hasParameterAnnotation(RequestParam.class)) {
		Set<? extends MediaType> consumes = context.getOperationContext().consumes();
		HttpMethod method = context.getOperationContext().httpMethod();
		if (consumes.contains(MediaType.APPLICATION_FORM_URLENCODED) && method == HttpMethod.POST) {
			context.parameterBuilder().parameterType("form");
		} else if (consumes.contains(MediaType.MULTIPART_FORM_DATA) && method == HttpMethod.POST) {
			context.parameterBuilder().parameterType("formData");
		} else {
			context.parameterBuilder().parameterType("query");
		}
		return;
	}
	if (parameter.hasParameterAnnotation(RequestHeader.class)) {
		context.parameterBuilder().parameterType("header");
		return;
	}
	if (parameter.hasParameterAnnotation(ModelAttribute.class)) {
		log.warn(StrUtil.concat("@ModelAttribute annotated parameters should have already been expanded via ",
			"the ExpandedParameterBuilderPlugin"));
	}
	if (parameter.hasParameterAnnotation(ApiParam.class)) {
		context.parameterBuilder().parameterType("query");
		return;
	}
	if (parameter.hasParameterAnnotation(MapEnum.class)) {
		context.parameterBuilder().parameterType("query");
		return;
	}
	context.parameterBuilder().parameterType("body");
}
 
Example #25
Source Project: BlogManagePlatform   Author: Frodez   File: DefaultParamPlugin.java    License: Apache License 2.0 4 votes vote down vote up
private static void warn(ParameterContext context, Class<?> parameterClass) {
	String pattern = context.getOperationContext().requestMappingPattern();
	String parameterName = parameterClass.getCanonicalName();
	log.warn(StrUtil.concat(pattern, "的参数", parameterName, "既未配置@", param, "注解,也未配置@", model, "注解"));
}
 
Example #26
Source Project: BlogManagePlatform   Author: Frodez   File: DefaultRequiredPlugin.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public void apply(ParameterContext context) {
	context.parameterBuilder().required(isRequired(context.resolvedMethodParameter()));
}
 
Example #27
Source Project: Resource   Author: lovelifeming   File: ParametersReader.java    License: GNU General Public License v3.0 4 votes vote down vote up
private List<Parameter> readParameters(OperationContext context)
{
    List<Parameter> parameters = Lists.newArrayList();
    List<ResolvedMethodParameter> methodParameters = context.getParameters();

    Map<String, ApiSingleParam> paramMap = new HashMap<>();
    Field[] fields = ModelCache.getInstance().getParamClass().getDeclaredFields();
    String type = new String();
    for (Field field : fields)
    {
        if (field.isAnnotationPresent(ApiSingleParam.class))
        {
            ApiSingleParam param = field.getAnnotation(ApiSingleParam.class);
            try
            {
                String name = (String)field.get(type);
                paramMap.put(name, param);
            }
            catch (Exception e)
            {
            }
        }
    }

    for (ResolvedMethodParameter methodParameter : methodParameters)
    {
        ParameterContext parameterContext = new ParameterContext(methodParameter,
            new ParameterBuilder(),
            context.getDocumentationContext(),
            context.getGenericsNamingStrategy(),
            context);
        Function<ResolvedType, ? extends ModelReference> factory = createModelRefFactory(parameterContext);
        Optional<ApiJsonObject> annotation = context.findAnnotation(ApiJsonObject.class);

        if (annotation.isPresent())
        {
            ModelCache.getInstance().setFactory(factory)
                .setParamMap(paramMap)
                .addModel(annotation.get());

        }
    }
    return parameters;
}
 
Example #28
@Override
public void apply(ParameterContext context) {
    if (isCookieValue(context)) {
        context.parameterBuilder().parameterType("cookie");
    }
}
 
Example #29
private boolean isCookieValue(ParameterContext context) {
    List<Annotation> annotations = context.resolvedMethodParameter().getAnnotations();
    return annotations.stream().anyMatch(annotation -> annotation.annotationType() == CookieValue.class);
}
 
Example #30
@Override
public void apply(ParameterContext context) {
    if (isCookieValue(context)) {
        context.parameterBuilder().parameterType("cookie");
    }
}