Search in sources :

Example 1 with PagedListResponseFactoryClassView

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();
}
Also used : MethodModel(com.google.api.codegen.config.MethodModel) FieldConfig(com.google.api.codegen.config.FieldConfig) PageStreamingConfig(com.google.api.codegen.config.PageStreamingConfig) PagedListResponseFactoryClassView(com.google.api.codegen.viewmodel.PagedListResponseFactoryClassView) FieldModel(com.google.api.codegen.config.FieldModel)

Aggregations

FieldConfig (com.google.api.codegen.config.FieldConfig)1 FieldModel (com.google.api.codegen.config.FieldModel)1 MethodModel (com.google.api.codegen.config.MethodModel)1 PageStreamingConfig (com.google.api.codegen.config.PageStreamingConfig)1 PagedListResponseFactoryClassView (com.google.api.codegen.viewmodel.PagedListResponseFactoryClassView)1