use of com.google.api.codegen.configgen.nodes.FieldConfigNode in project toolkit by googleapis.
the class ConfigMerger method mergeConfig.
private FieldConfigNode mergeConfig(ApiModel model, FieldConfigNode configNode) {
ConfigNode typeNode = mergeType(configNode);
if (typeNode == null) {
return null;
}
ConfigNode versionNode = mergeVersion(configNode, typeNode);
if (versionNode == null) {
return null;
}
ConfigNode languageSettingsNode = languageSettingsMerger.mergeLanguageSettings(packageName, configNode, versionNode);
mergeLicenseHeader(configNode, languageSettingsNode);
interfaceMerger.mergeInterfaces(model, configNode);
return configNode;
}
use of com.google.api.codegen.configgen.nodes.FieldConfigNode in project toolkit by googleapis.
the class InterfaceMerger method mergeInterfaces.
public void mergeInterfaces(ApiModel model, ConfigNode configNode) {
FieldConfigNode interfacesNode = MissingFieldTransformer.append("interfaces", configNode).generate();
if (NodeFinder.hasContent(interfacesNode.getChild())) {
return;
}
ConfigNode interfacesValueNode = ListTransformer.generateList(model.getInterfaces(), interfacesNode, this::generateInterfaceNode);
interfacesNode.setChild(interfacesValueNode).setComment(new DefaultComment("A list of API interface configurations."));
}
use of com.google.api.codegen.configgen.nodes.FieldConfigNode in project toolkit by googleapis.
the class MethodMerger method generateFlatteningNode.
private ConfigNode generateFlatteningNode(ConfigNode prevNode, List<String> parameterList) {
ConfigNode flatteningNode = new FieldConfigNode(NodeFinder.getNextLine(prevNode), "flattening").setComment(new FixmeComment("Configure which groups of fields should be flattened into method params."));
prevNode.insertNext(flatteningNode);
ConfigNode flatteningGroupsNode = new FieldConfigNode(NodeFinder.getNextLine(flatteningNode), "groups");
flatteningNode.setChild(flatteningGroupsNode);
ConfigNode groupNode = new ListItemConfigNode(NodeFinder.getNextLine(flatteningGroupsNode));
flatteningGroupsNode.setChild(groupNode);
ConfigNode parametersNode = new FieldConfigNode(groupNode.getStartLine(), "parameters");
groupNode.setChild(parametersNode);
ListTransformer.generateStringList(parameterList, parametersNode);
return flatteningNode;
}
use of com.google.api.codegen.configgen.nodes.FieldConfigNode in project toolkit by googleapis.
the class MethodMerger method generateFieldNamePatterns.
private ConfigNode generateFieldNamePatterns(ConfigNode prevNode, MethodModel method, final Map<String, String> nameMap) {
ConfigNode fieldNamePatternsNode = new FieldConfigNode(NodeFinder.getNextLine(prevNode), "field_name_patterns");
ConfigNode fieldNamePatternsValueNode = ListTransformer.generateList(method.getResourcePatternNameMap(nameMap).entrySet(), fieldNamePatternsNode, (startLine, entry) -> FieldConfigNode.createStringPair(startLine, entry.getKey(), entry.getValue()));
if (!fieldNamePatternsValueNode.isPresent()) {
return prevNode;
}
prevNode.insertNext(fieldNamePatternsNode);
return fieldNamePatternsNode;
}
use of com.google.api.codegen.configgen.nodes.FieldConfigNode in project toolkit by googleapis.
the class PageStreamingMerger method generatePageStreamingRequestNode.
private ConfigNode generatePageStreamingRequestNode(ConfigNode parentNode, MethodModel method) {
ConfigNode requestNode = new FieldConfigNode(NodeFinder.getNextLine(parentNode), "request");
parentNode.setChild(requestNode);
ConfigNode requestValueNode = generatePageStreamingRequestValueNode(requestNode, NodeFinder.getNextLine(requestNode), method);
return requestValueNode.isPresent() ? requestNode : null;
}
Aggregations