use of com.google.api.codegen.configgen.ConfigYamlReader in project toolkit by googleapis.
the class DiscoGapicGeneratorApi method loadConfigFromFiles.
private static ConfigProto loadConfigFromFiles(List<String> configFileNames) {
DiagCollector diagCollector = new SimpleDiagCollector();
ConfigYamlReader yamlReader = new ConfigYamlReader();
MessageGenerator messageGenerator = new MessageGenerator(ConfigProto.newBuilder());
for (File file : pathsToFiles(configFileNames)) {
ConfigHelper helper = new ConfigHelper(diagCollector, file.getName());
ConfigNode configNode = yamlReader.generateConfigNode(file, helper);
if (configNode == null) {
continue;
}
messageGenerator.visit(configNode.getChild());
}
ConfigProto configProto = (ConfigProto) messageGenerator.getValue();
if (configProto == null || configProto.equals(ConfigProto.getDefaultInstance())) {
return null;
}
return configProto;
}
Aggregations