use of com.google.api.codegen.viewmodel.PagedListResponseFactoryClassView in project toolkit by googleapis.
the class PageStreamingTransformer method generateFactoryClass.
private PagedListResponseFactoryClassView generateFactoryClass(MethodContext context) {
SurfaceNamer namer = context.getNamer();
MethodModel method = context.getMethodModel();
ImportTypeTable typeTable = context.getTypeTable();
PageStreamingConfig pageStreaming = context.getMethodConfig().getPageStreaming();
FieldModel resourceField = pageStreaming.getResourcesField();
FieldConfig resourceFieldConfig = pageStreaming.getResourcesFieldConfig();
PagedListResponseFactoryClassView.Builder factory = PagedListResponseFactoryClassView.newBuilder();
factory.name(namer.getPagedListResponseFactoryConstName(method));
factory.requestTypeName(method.getAndSaveRequestTypeName(typeTable, namer));
factory.responseTypeName(method.getAndSaveResponseTypeName(typeTable, namer));
factory.resourceTypeName(typeTable.getAndSaveNicknameForElementType(resourceField));
factory.pagedListResponseTypeName(namer.getAndSavePagedResponseTypeName(context, resourceFieldConfig));
factory.pageStreamingDescriptorName(namer.getPageStreamingDescriptorConstName(method));
return factory.build();
}
Aggregations