Search in sources :

Example 1 with ReroutedGrpcView

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

the class CSharpCommonTransformer method generateReroutedGrpcView.

public List<ReroutedGrpcView> generateReroutedGrpcView(GapicInterfaceContext context) {
    SurfaceNamer namer = context.getNamer();
    Set<ReroutedGrpcView> reroutedViews = new LinkedHashSet<>();
    for (MethodModel method : getSupportedMethods(context)) {
        MethodConfig methodConfig = context.getMethodConfig(method);
        String reroute = methodConfig.getRerouteToGrpcInterface();
        if (reroute != null) {
            ReroutedGrpcView rerouted = ReroutedGrpcView.newBuilder().grpcClientVarName(namer.getReroutedGrpcClientVarName(methodConfig)).typeName(namer.getReroutedGrpcTypeName(context.getImportTypeTable(), methodConfig)).getMethodName(namer.getReroutedGrpcMethodName(methodConfig)).build();
            reroutedViews.add(rerouted);
        }
    }
    return new ArrayList<ReroutedGrpcView>(reroutedViews);
}
Also used : LinkedHashSet(java.util.LinkedHashSet) MethodConfig(com.google.api.codegen.config.MethodConfig) MethodModel(com.google.api.codegen.config.MethodModel) ArrayList(java.util.ArrayList) ReroutedGrpcView(com.google.api.codegen.viewmodel.ReroutedGrpcView) SurfaceNamer(com.google.api.codegen.transformer.SurfaceNamer)

Aggregations

MethodConfig (com.google.api.codegen.config.MethodConfig)1 MethodModel (com.google.api.codegen.config.MethodModel)1 SurfaceNamer (com.google.api.codegen.transformer.SurfaceNamer)1 ReroutedGrpcView (com.google.api.codegen.viewmodel.ReroutedGrpcView)1 ArrayList (java.util.ArrayList)1 LinkedHashSet (java.util.LinkedHashSet)1