• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java ParameterProcessor类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中io.swagger.util.ParameterProcessor的典型用法代码示例。如果您正苦于以下问题:Java ParameterProcessor类的具体用法?Java ParameterProcessor怎么用?Java ParameterProcessor使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



ParameterProcessor类属于io.swagger.util包,在下文中一共展示了ParameterProcessor类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: createParameter

import io.swagger.util.ParameterProcessor; //导入依赖的package包/类
public static Parameter createParameter(Swagger swagger, ApiImplicitParam paramAnnotation) {
  Parameter parameter = createParameterInstance(paramAnnotation);
  Type dataType = ReflectionUtils.typeFromString(paramAnnotation.dataType());
  parameter = ParameterProcessor.applyAnnotations(swagger,
      parameter,
      dataType,
      Arrays.asList(paramAnnotation));
  return parameter;
}
 
开发者ID:apache,项目名称:incubator-servicecomb-java-chassis,代码行数:10,代码来源:AnnotationUtils.java


示例2: readParam

import io.swagger.util.ParameterProcessor; //导入依赖的package包/类
private Parameter readParam(Swagger swagger, Type type,Class<?> cls, ApiParam param) {
	PrimitiveType fromType = PrimitiveType.fromType(type);
	final Parameter para = null == fromType ? new FormParameter() : new QueryParameter();
	Parameter parameter = ParameterProcessor.applyAnnotations(swagger, para,
			type == null ? String.class : type, null == param ? new ArrayList<Annotation>()
					: Collections.<Annotation> singletonList(param));
	if (parameter instanceof AbstractSerializableParameter) {
		final AbstractSerializableParameter<?> p = (AbstractSerializableParameter<?>) parameter;
		if (p.getType() == null) p.setType(null == fromType ? "string" : fromType.getCommonName());
		p.setRequired(p.getRequired() == true ? true : cls.isPrimitive());
	}
	return parameter;
}
 
开发者ID:Sayi,项目名称:swagger-dubbo,代码行数:14,代码来源:DubboReaderExtension.java


示例3: readImplicitParam

import io.swagger.util.ParameterProcessor; //导入依赖的package包/类
private Parameter readImplicitParam(Swagger swagger, ApiImplicitParam param) {
	PrimitiveType fromType = PrimitiveType.fromName(param.paramType());
	final Parameter p = null == fromType ? new FormParameter() : new QueryParameter();
	final Type type = ReflectionUtils.typeFromString(param.dataType());
	return ParameterProcessor.applyAnnotations(swagger, p, type == null ? String.class : type,
			Collections.<Annotation> singletonList(param));
}
 
开发者ID:Sayi,项目名称:swagger-dubbo,代码行数:8,代码来源:DubboReaderExtension.java


示例4: readImplicitParam

import io.swagger.util.ParameterProcessor; //导入依赖的package包/类
private Parameter readImplicitParam(Swagger swagger, ApiImplicitParam param) {
    final Parameter p = ParameterFactory.createParam(param.paramType());
    if (p == null) {
        return null;
    }
    final Type type = ReflectionUtils.typeFromString(param.dataType());
    return ParameterProcessor.applyAnnotations(swagger, p, type == null ? String.class : type,
            Collections.<Annotation>singletonList(param));
}
 
开发者ID:yangfuhai,项目名称:jboot,代码行数:10,代码来源:ControllerReaderExtension.java


示例5: readImplicitParam

import io.swagger.util.ParameterProcessor; //导入依赖的package包/类
private Parameter readImplicitParam(Swagger swagger, ApiImplicitParam param) {
    final Parameter p = createParam(param.paramType());
    if (p == null) {
        return null;
    }
    final Type type = typeFromString(param.dataType());
    return ParameterProcessor.applyAnnotations(swagger, p, type == null ? String.class : type,
            Collections.<Annotation>singletonList(param));
}
 
开发者ID:CenturyLinkCloud,项目名称:mdw,代码行数:10,代码来源:ResourceReaderExtension.java


示例6: getParameters

import io.swagger.util.ParameterProcessor; //导入依赖的package包/类
private List<Parameter> getParameters(Type type, List<Annotation> annotations) {
    final Iterator<SwaggerExtension> chain = SwaggerExtensions.chain();
    if (!chain.hasNext()) {
        return Collections.emptyList();
    }
    LOGGER.debug("getParameters for " + type);
    Set<Type> typesToSkip = new HashSet<>();
    final SwaggerExtension extension = chain.next();
    LOGGER.debug("trying extension " + extension);

    final List<Parameter> parameters = extension.extractParameters(annotations, type, typesToSkip, chain);
    if (parameters.size() > 0) {
        final List<Parameter> processed = new ArrayList<>(parameters.size());
        processed.addAll(parameters.stream().filter(parameter -> ParameterProcessor
                                                                         .applyAnnotations(swagger, parameter, type,
                                                                                           annotations) != null)
                                   .collect(Collectors.toList()));
        return processed;
    } else {
        LOGGER.debug("no parameter found, looking at body params");
        final List<Parameter> body = new ArrayList<>();
        if (!typesToSkip.contains(type)) {
            Parameter param = ParameterProcessor.applyAnnotations(swagger, null, type, annotations);
            if (param != null) {
                body.add(param);
            }
        }
        return body;
    }
}
 
开发者ID:wso2,项目名称:msf4j,代码行数:31,代码来源:ExtendedSwaggerReader.java


示例7: getParameters

import io.swagger.util.ParameterProcessor; //导入依赖的package包/类
private List<Parameter> getParameters(Type type, List<Annotation> annotations) {
    final Iterator<SwaggerExtension> chain = SwaggerExtensions.chain();
    if (!chain.hasNext()) {
        return Collections.emptyList();
    }
    Logger.debug("getParameters for " + type);
    Set<Type> typesToSkip = new HashSet<Type>();
    final SwaggerExtension extension = chain.next();
    Logger.debug("trying extension " + extension);

    final List<Parameter> parameters = extension.extractParameters(annotations, type, typesToSkip, chain);
    if (parameters.size() > 0) {
        final List<Parameter> processed = new ArrayList<Parameter>(parameters.size());
        for (Parameter parameter : parameters) {
            if (ParameterProcessor.applyAnnotations(swagger, parameter, type, annotations) != null) {
                processed.add(parameter);
            }
        }
        return processed;
    } else {
        Logger.debug("no parameter found, looking at body params");
        final List<Parameter> body = new ArrayList<Parameter>();
        if (!typesToSkip.contains(type)) {
            Parameter param = ParameterProcessor.applyAnnotations(swagger, null, type, annotations);
            if (param != null) {
                body.add(param);
            }
        }
        return body;
    }
}
 
开发者ID:abhishekShukla,项目名称:swagger-play,代码行数:32,代码来源:PlayReader.java


示例8: getParameters

import io.swagger.util.ParameterProcessor; //导入依赖的package包/类
protected List<Parameter> getParameters(Type type, List<Annotation> annotations) {
    if (!hasValidAnnotations(annotations) || isApiParamHidden(annotations)) {
        return Collections.emptyList();
    }

    Iterator<SwaggerExtension> chain = SwaggerExtensions.chain();
    List<Parameter> parameters = new ArrayList<Parameter>();
    Class<?> cls = TypeUtils.getRawType(type, type);
    LOG.debug("Looking for path/query/header/form/cookie params in " + cls);

    if (chain.hasNext()) {
        SwaggerExtension extension = chain.next();
        LOG.debug("trying extension " + extension);
        parameters = extension.extractParameters(annotations, type, typesToSkip, chain);
    }

    if (!parameters.isEmpty()) {
        for (Parameter parameter : parameters) {
            ParameterProcessor.applyAnnotations(swagger, parameter, type, annotations);
        }
    } else {
        LOG.debug("Looking for body params in " + cls);
        if (!typesToSkip.contains(type)) {
            Parameter param = ParameterProcessor.applyAnnotations(swagger, null, type, annotations);
            if (param != null) {
                parameters.add(param);
            }
        }
    }
    return parameters;
}
 
开发者ID:kongchen,项目名称:swagger-maven-plugin,代码行数:32,代码来源:AbstractReader.java


示例9: extractParameters

import io.swagger.util.ParameterProcessor; //导入依赖的package包/类
@Override
public List<Parameter> extractParameters(List<Annotation> annotations, Type type, Set<Type> typesToSkip,
		Iterator<SwaggerExtension> chain) {

	// check PropertyBox type and body parameter case
	if (isBodyParameter(annotations)) {
		final PropertyBoxTypeInfo pbType = PropertyBoxTypeInfo.check(type).orElse(null);
		if (pbType != null) {
			// check property set
			final PropertySetRef aps = hasApiPropertySet(annotations);
			if (aps != null) {
				PropertySet<?> propertySet = PropertySetRefIntrospector.get().getPropertySet(aps);
				if (propertySet != null) {

					// Skip PropertyBox type
					Set<Type> skip = new HashSet<>();
					if (typesToSkip != null) {
						skip.addAll(typesToSkip);
					}
					skip.add(PropertyBox.class);
					skip.add(PropertyBox[].class);

					// load other parameters, if any
					List<Parameter> parameters = new LinkedList<>();
					if (chain.hasNext()) {
						List<Parameter> ps = chain.next().extractParameters(annotations, type, skip, chain);
						if (ps != null) {
							parameters.addAll(ps);
						}
					}

					ApiPropertySetModel psm = hasApiPropertySetModel(annotations);

					final Model model = buildPropertyBoxModel(propertySet, false,
							(pbType.isContainerType() && !pbType.isMap()),
							(psm != null) ? AnnotationUtils.getStringValue(psm.value()) : null,
							(psm != null) ? AnnotationUtils.getStringValue(psm.description()) : null,
							(psm != null) ? AnnotationUtils.getStringValue(psm.reference()) : null,
							SwaggerContext.getSwagger());
					BodyParameter bp = new BodyParameter();
					bp.setRequired(isParameterRequired(annotations));
					bp.schema(model);
					Parameter parameter = ParameterProcessor.applyAnnotations(new Swagger(), bp, type, annotations);
					if (parameter != null) {
						if (parameter instanceof BodyParameter) {
							((BodyParameter) parameter).schema(model);
						}
						parameters.add(parameter);
					}

					return parameters;
				}
			}
		}
	}

	return super.extractParameters(annotations, type, typesToSkip, chain);
}
 
开发者ID:holon-platform,项目名称:holon-jaxrs,代码行数:59,代码来源:PropertyBoxSwaggerExtension.java



注:本文中的io.swagger.util.ParameterProcessor类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java WrapperParameter类代码示例发布时间:2022-05-22
下一篇:
Java LoadCaster类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap