use of io.servicecomb.swagger.invocation.arguments.producer.ProducerArgumentsMapper in project java-chassis by ServiceComb.
the class ProducerSchemaFactory method connectToProvider.
@Override
protected void connectToProvider(ProducerSchemaContext context) {
if (context.getGenerator() == null) {
generateSwagger(context);
}
// 建立契约与producer之间的参数映射关系
Class<?> swaggerIntf = ClassUtils.getJavaInterface(context.getSchemaMeta().getSwagger());
for (OperationMeta operationMeta : context.getSchemaMeta().getOperations()) {
OperationGenerator operationGenerator = context.getGenerator().getOperationGeneratorMap().get(operationMeta.getOperationId());
Method swaggerMethod = ReflectUtils.findMethod(swaggerIntf, operationMeta.getOperationId());
List<Parameter> swaggerParameters = operationMeta.getSwaggerOperation().getParameters();
Method producerMethod = operationGenerator.getProviderMethod();
List<Parameter> producerParameters = operationGenerator.getProviderParameters();
ProducerArgumentsMapper argsMapper = producerArgsMapperFactory.createArgumentsMapper(context.getSchemaMeta().getSwagger(), swaggerMethod, swaggerParameters, producerMethod, producerParameters);
createOperation(context, operationMeta, argsMapper);
}
}
Aggregations