本文整理了Java中com.google.api.tools.framework.yaml.YamlReader.readConfig()
方法的一些代码示例,展示了YamlReader.readConfig()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。YamlReader.readConfig()
方法的具体详情如下:
包路径:com.google.api.tools.framework.yaml.YamlReader
类名称:YamlReader
方法名:readConfig
[英]Same as #readConfig(DiagCollector,String,String,Map) but works with a default assignment of config types which are known to the framework.
[中]与#readConfig(DiagCollector、String、String、Map)相同,但使用框架已知的配置类型的默认分配。
代码示例来源:origin: com.google.api/api-compiler
/**
* Same as {@link #readConfig(DiagCollector, String, String, Map)} but works with
* a default assignment of config types which are known to the framework.
*/
@Nullable public static ConfigSource readConfig(DiagCollector collector,
String inputName, String input) {
return readConfig(collector, inputName, input, SUPPORTED_CONFIG_TYPES);
}
代码示例来源:origin: googleapis/api-compiler
/**
* Same as {@link #readConfig(DiagCollector, String, String, Map)} but works with
* a default assignment of config types which are known to the framework.
*/
@Nullable public static ConfigSource readConfig(DiagCollector collector,
String inputName, String input) {
return readConfig(collector, inputName, input, SUPPORTED_CONFIG_TYPES);
}
代码示例来源:origin: com.google.api/api-compiler
@Nullable
private static ConfigSource getConfigSourceFromFile(
DiagCollector diag, String filename, ByteString fileContents) {
if (filename.endsWith(".binarypb") || filename.endsWith(".binaryproto")) {
return ProtoServiceReader.readBinaryConfig(diag, filename, fileContents);
}
if (filename.endsWith(".textproto")) {
return ProtoServiceReader.readTextConfig(diag, filename, fileContents);
}
return YamlReader.readConfig(diag, filename, fileContents.toStringUtf8());
}
代码示例来源:origin: googleapis/api-compiler
@Nullable
private static ConfigSource getConfigSourceFromFile(
DiagCollector diag, String filename, ByteString fileContents) {
if (filename.endsWith(".binarypb") || filename.endsWith(".binaryproto")) {
return ProtoServiceReader.readBinaryConfig(diag, filename, fileContents);
}
if (filename.endsWith(".textproto")) {
return ProtoServiceReader.readTextConfig(diag, filename, fileContents);
}
return YamlReader.readConfig(diag, filename, fileContents.toStringUtf8());
}
代码示例来源:origin: googleapis/gapic-generator
YamlReader.readConfig(collector, inputName, input, supportedConfigTypes);
代码示例来源:origin: googleapis/api-compiler
/** Parses the config files, in Yaml format. */
public ImmutableList<ConfigSource> getApiYamlConfigSources(
DiagCollector diag, List<String> configFileNames) {
ImmutableList.Builder<ConfigSource> builder = ImmutableList.builder();
for (String fileName : configFileNames) {
ConfigSource config = YamlReader.readConfig(diag, fileName, readTestData(fileName));
if (config != null) {
builder.add(config);
}
}
return builder.build();
}
代码示例来源:origin: com.google.api/api-compiler
/** Returns a {@link Model} generated from the {@link Service} and the additionalConfigs. */
private static Model createModel(Service service, List<FileWrapper> additionalConfigs) {
Model model = Model.create(service);
if (additionalConfigs != null) {
List<ConfigSource> allConfigs = Lists.newArrayList();
allConfigs.add(model.getServiceConfigSource());
for (FileWrapper additionalConfig : additionalConfigs) {
allConfigs.add(
YamlReader.readConfig(
model.getDiagReporter().getDiagCollector(),
additionalConfig.getFilename(),
additionalConfig.getFileContents().toStringUtf8()));
}
model.setConfigSources(allConfigs);
}
StandardSetup.registerStandardProcessors(model);
StandardSetup.registerStandardConfigAspects(model);
return model;
}
}
代码示例来源:origin: googleapis/api-compiler
/** Returns a {@link Model} generated from the {@link Service} and the additionalConfigs. */
private static Model createModel(Service service, List<FileWrapper> additionalConfigs) {
Model model = Model.create(service);
if (additionalConfigs != null) {
List<ConfigSource> allConfigs = Lists.newArrayList();
allConfigs.add(model.getServiceConfigSource());
for (FileWrapper additionalConfig : additionalConfigs) {
allConfigs.add(
YamlReader.readConfig(
model.getDiagReporter().getDiagCollector(),
additionalConfig.getFilename(),
additionalConfig.getFileContents().toStringUtf8()));
}
model.setConfigSources(allConfigs);
}
StandardSetup.registerStandardProcessors(model);
StandardSetup.registerStandardConfigAspects(model);
return model;
}
}
代码示例来源:origin: googleapis/api-compiler
private ConfigSource testFromInputString(String inputName, String content) {
SimpleDiagCollector diag = new SimpleDiagCollector();
ConfigSource config = YamlReader.readConfig(diag, inputName, content, supportedConfigTypes);
if (config == null) {
testOutput().println("errors!!");
testOutput().println(diag);
} else {
testOutput().println(TextFormatForTest.INSTANCE.printToString(config.getConfig()));
}
return config;
}
内容来源于网络,如有侵权,请联系作者删除!