当前位置: 首页>>代码示例>>Java>>正文


Java ParameterProcessor.applyAnnotations方法代码示例

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


在下文中一共展示了ParameterProcessor.applyAnnotations方法的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.applyAnnotations方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。