/** Lists the methods on the service (the methodFilter will be applied if non-empty) */
private static void listMethods(
Output output,
String protoDiscoveryRoot,
ServiceDescriptor descriptor,
Optional<String> methodFilter,
Optional<Boolean> withMessage) {
boolean printedService = false;
// Due to the way the protos are discovered, the leaf directly of the protoDiscoveryRoot
// is the same as the root directory as the proto file
File protoDiscoveryDir = new File(protoDiscoveryRoot).getParentFile();
for (MethodDescriptor method : descriptor.getMethods()) {
if (!methodFilter.isPresent() || method.getName().contains(methodFilter.get())) {
// Only print the service name once - and only if a method is going to be printed
if (!printedService) {
File pFile = new File(protoDiscoveryDir, descriptor.getFile().getName());
output.writeLine(descriptor.getFullName() + " -> " + pFile.getAbsolutePath());
printedService = true;
}
output.writeLine(" " + descriptor.getFullName() + "/" + method.getName());
// If requested, add the message definition
if (withMessage.isPresent() && withMessage.get()) {
output.writeLine(renderDescriptor(method.getInputType(), " "));
output.newLine();
}
}
}
if (printedService) {
output.newLine();
}
}
ServiceList.java 文件源码
java
阅读 28
收藏 0
点赞 0
评论 0
项目:polyglot
作者:
评论列表
文章目录