Search in sources :

Example 1 with GrpcElementDocView

use of com.google.api.codegen.viewmodel.GrpcElementDocView in project toolkit by googleapis.

the class GrpcElementDocTransformer method generateMessageDocs.

private List<GrpcElementDocView> generateMessageDocs(ModelTypeTable typeTable, SurfaceNamer namer, ProtoContainerElement containerElement) {
    ImmutableList.Builder<GrpcElementDocView> messageDocs = ImmutableList.builder();
    for (MessageType message : containerElement.getMessages()) {
        // Doesn't have to document map entries because a dictionary is used.
        if (message.isMapEntry()) {
            continue;
        }
        GrpcMessageDocView.Builder doc = GrpcMessageDocView.newBuilder();
        doc.name(namer.getMessageTypeName(typeTable, message));
        doc.fullName(typeTable.getFullNameFor(TypeRef.of(message)));
        doc.fileUrl(GapicParser.getFileUrl(message.getFile()));
        doc.lines(namer.getDocLines(GapicParser.getDocString(message)));
        doc.properties(generateMessagePropertyDocs(typeTable, namer, FieldConfig.toFieldTypeIterableFromField(message.getFields())));
        doc.elementDocs(generateElementDocs(typeTable, namer, message));
        doc.packageName(message.getFile().getFullName());
        messageDocs.add(doc.build());
    }
    return messageDocs.build();
}
Also used : GrpcMessageDocView(com.google.api.codegen.viewmodel.GrpcMessageDocView) ImmutableList(com.google.common.collect.ImmutableList) GrpcElementDocView(com.google.api.codegen.viewmodel.GrpcElementDocView) MessageType(com.google.api.tools.framework.model.MessageType)

Example 2 with GrpcElementDocView

use of com.google.api.codegen.viewmodel.GrpcElementDocView in project toolkit by googleapis.

the class PythonGapicSurfaceTransformer method generateEnumFileElements.

private List<GrpcElementDocView> generateEnumFileElements(ModelTypeTable typeTable, SurfaceNamer namer, ProtoContainerElement containerElement) {
    ImmutableList.Builder<GrpcElementDocView> elements = ImmutableList.builder();
    elements.addAll(elementDocTransformer.generateEnumDocs(typeTable, namer, containerElement.getEnums()));
    for (MessageType message : containerElement.getMessages()) {
        List<GrpcElementDocView> elementDocs = generateEnumFileElements(typeTable, namer, message);
        if (!elementDocs.isEmpty()) {
            GrpcMessageDocView.Builder messageView = GrpcMessageDocView.newBuilder();
            messageView.name(namer.publicClassName(Name.upperCamel(message.getSimpleName())));
            messageView.fullName(typeTable.getFullNameFor(TypeRef.of(message)));
            messageView.fileUrl(GapicParser.getFileUrl(message.getFile()));
            messageView.lines(namer.getDocLines(GapicParser.getDocString(message)));
            messageView.properties(ImmutableList.<ParamDocView>of());
            messageView.elementDocs(elementDocs);
            messageView.packageName(message.getFile().getFullName());
            elements.add(messageView.build());
        }
    }
    return elements.build();
}
Also used : GrpcMessageDocView(com.google.api.codegen.viewmodel.GrpcMessageDocView) ImmutableList(com.google.common.collect.ImmutableList) GrpcElementDocView(com.google.api.codegen.viewmodel.GrpcElementDocView) MessageType(com.google.api.tools.framework.model.MessageType)

Example 3 with GrpcElementDocView

use of com.google.api.codegen.viewmodel.GrpcElementDocView in project toolkit by googleapis.

the class GrpcElementDocTransformer method generateEnumDocs.

public List<GrpcElementDocView> generateEnumDocs(ModelTypeTable typeTable, SurfaceNamer namer, ProtoContainerElement containerElement) {
    ImmutableList.Builder<GrpcElementDocView> enumDocs = ImmutableList.builder();
    for (EnumType enumElement : containerElement.getEnums()) {
        if (!enumElement.isReachable()) {
            continue;
        }
        GrpcEnumDocView.Builder doc = GrpcEnumDocView.newBuilder();
        doc.name(namer.getEnumTypeName(typeTable, enumElement));
        doc.lines(namer.getDocLines(GapicParser.getDocString(enumElement)));
        doc.values(generateEnumValueDocs(namer, enumElement));
        doc.packageName(enumElement.getFile().getFullName());
        enumDocs.add(doc.build());
    }
    return enumDocs.build();
}
Also used : GrpcEnumDocView(com.google.api.codegen.viewmodel.GrpcEnumDocView) ImmutableList(com.google.common.collect.ImmutableList) EnumType(com.google.api.tools.framework.model.EnumType) GrpcElementDocView(com.google.api.codegen.viewmodel.GrpcElementDocView)

Example 4 with GrpcElementDocView

use of com.google.api.codegen.viewmodel.GrpcElementDocView in project toolkit by googleapis.

the class GrpcElementDocTransformer method generateMessageDocs.

private List<GrpcElementDocView> generateMessageDocs(GapicProductConfig productConfig, ModelTypeTable typeTable, SurfaceNamer namer, Collection<MessageType> messages) {
    ImmutableList.Builder<GrpcElementDocView> messageDocs = ImmutableList.builder();
    for (MessageType message : messages) {
        // Doesn't have to document map entries because a dictionary is used.
        if (message.isMapEntry()) {
            continue;
        }
        GrpcMessageDocView.Builder doc = GrpcMessageDocView.newBuilder();
        doc.name(namer.getMessageTypeName(typeTable, message));
        doc.fullName(typeTable.getFullNameFor(TypeRef.of(message)));
        doc.fileUrl(GapicParser.getFileUrl(message.getFile()));
        doc.lines(namer.getDocLines(GapicParser.getDocString(message)));
        doc.properties(generateMessagePropertyDocs(typeTable, namer, FieldConfig.toFieldTypeIterableFromField(message.getFields())));
        doc.elementDocs(generateElementDocs(productConfig, typeTable, namer, message));
        doc.packageName(message.getFile().getFullName());
        messageDocs.add(doc.build());
    }
    return messageDocs.build();
}
Also used : GrpcMessageDocView(com.google.api.codegen.viewmodel.GrpcMessageDocView) ImmutableList(com.google.common.collect.ImmutableList) GrpcElementDocView(com.google.api.codegen.viewmodel.GrpcElementDocView) MessageType(com.google.api.tools.framework.model.MessageType)

Aggregations

GrpcElementDocView (com.google.api.codegen.viewmodel.GrpcElementDocView)4 ImmutableList (com.google.common.collect.ImmutableList)4 GrpcMessageDocView (com.google.api.codegen.viewmodel.GrpcMessageDocView)3 MessageType (com.google.api.tools.framework.model.MessageType)3 GrpcEnumDocView (com.google.api.codegen.viewmodel.GrpcEnumDocView)1 EnumType (com.google.api.tools.framework.model.EnumType)1