use of io.servicecomb.swagger.invocation.arguments.consumer.ConsumerArgumentsMapper in project java-chassis by ServiceComb.
the class ConsumerSchemaFactory method mapSameIntfParameters.
protected void mapSameIntfParameters(ConsumerSchemaContext context) {
for (OperationMeta operationMeta : context.getSchemaMeta().getOperations()) {
List<ArgumentMapper> consumerArgMapperList = new ArrayList<>();
int swaggerParameterCount = operationMeta.getSwaggerOperation().getParameters().size();
for (int idx = 0; idx < swaggerParameterCount; idx++) {
ConsumerArgumentSame argMapper = new ConsumerArgumentSame(idx, idx);
consumerArgMapperList.add(argMapper);
}
ConsumerArgumentsMapper argsMapper = new ConsumerArgumentsMapper(consumerArgMapperList, swaggerParameterCount);
createOperation(context, operationMeta, argsMapper);
}
}
use of io.servicecomb.swagger.invocation.arguments.consumer.ConsumerArgumentsMapper in project java-chassis by ServiceComb.
the class ConsumerSchemaFactory method mapDiffIntfParameters.
protected void mapDiffIntfParameters(ConsumerSchemaContext context) {
// 建立契约与consumer之间的参数映射关系
Class<?> swaggerIntf = ClassUtils.getJavaInterface(context.getSchemaMeta().getSwagger());
SwaggerGenerator generator = generateSwagger(context);
for (OperationMeta operationMeta : context.getSchemaMeta().getOperations()) {
OperationGenerator operationGenerator = generator.getOperationGeneratorMap().get(operationMeta.getOperationId());
// swagger集合可能大于consumer集合
if (operationGenerator == null) {
continue;
}
Method swaggerMethod = ReflectUtils.findMethod(swaggerIntf, operationMeta.getOperationId());
List<Parameter> swaggerParameters = operationMeta.getSwaggerOperation().getParameters();
Method consumerMethod = operationGenerator.getProviderMethod();
List<Parameter> consumerParameters = operationGenerator.getProviderParameters();
ConsumerArgumentsMapper argsMapper = consumerArgsMapperFactory.createArgumentsMapper(context.getSchemaMeta().getSwagger(), swaggerMethod, swaggerParameters, consumerMethod, consumerParameters);
createOperation(context, operationMeta, argsMapper);
}
}
Aggregations