use of com.google.api.codegen.configgen.nodes.NullConfigNode in project toolkit by googleapis.
the class PageStreamingMerger method generatePageStreamingRequestValueNode.
private ConfigNode generatePageStreamingRequestValueNode(ConfigNode parentNode, int startLine, MethodModel method) {
String pageTokenName = pageStreamingTransformer.getNameForPageToken();
String pageSizeName = pageStreamingTransformer.getNameForPageSize();
boolean hasTokenField = method.getInputField(pageTokenName) != null;
boolean hasPageSizeField = method.getInputField(pageSizeName) != null;
ConfigNode requestValueNode = null;
if (hasPageSizeField) {
requestValueNode = FieldConfigNode.createStringPair(startLine, "page_size_field", pageSizeName);
if (hasTokenField) {
ConfigNode tokenFieldNode = FieldConfigNode.createStringPair(NodeFinder.getNextLine(requestValueNode), "token_field", pageTokenName);
requestValueNode.insertNext(tokenFieldNode);
}
} else if (hasTokenField) {
requestValueNode = FieldConfigNode.createStringPair(startLine, "token_field", pageTokenName);
} else {
return new NullConfigNode();
}
parentNode.setChild(requestValueNode);
return requestValueNode;
}
Aggregations