private MethodContext buildMethodContext(MethodDescriptorProto methodProto, ProtoTypeMap typeMap, List<Location> locations,
                                             int methodNumber) {
        MethodContext methodContext = new MethodContext();
        methodContext.setMethodName(lowerCaseFirst(methodProto.getName()));
        methodContext.setInputType(typeMap.toJavaTypeName(methodProto.getInputType()));
        methodContext.setOutputType(typeMap.toJavaTypeName(methodProto.getOutputType()));
        methodContext.setDeprecated(methodProto.getOptions() != null && methodProto.getOptions().getDeprecated());
        methodContext.setManyInput(methodProto.getClientStreaming());
        methodContext.setManyOutput(methodProto.getServerStreaming());
        methodContext.setMethodNumber(methodNumber);

        Optional<Location> found = Optional.empty();
        for (Location location : locations) {
            if (location.getPathCount() == METHOD_NUMBER_OF_PATHS &&
                    location.getPath(METHOD_NUMBER_OF_PATHS - 1) == methodNumber) {
                found = Optional.of(location);
                break;
            }
        }
        Location methodLocation = found
                .orElseGet(Location::getDefaultInstance);
        methodContext.setJavaDoc(getJavaDoc(getComments(methodLocation), getMethodJavaDocPrefix()));

        if (!methodProto.getClientStreaming() && !methodProto.getServerStreaming()) {
            methodContext.setReactiveCallsMethodName("oneToOne");
            methodContext.setGrpcCallsMethodName("asyncUnaryCall");
        }
        if (!methodProto.getClientStreaming() && methodProto.getServerStreaming()) {
            methodContext.setReactiveCallsMethodName("oneToMany");
            methodContext.setGrpcCallsMethodName("asyncServerStreamingCall");
        }
        if (methodProto.getClientStreaming() && !methodProto.getServerStreaming()) {
            methodContext.setReactiveCallsMethodName("manyToOne");
            methodContext.setGrpcCallsMethodName("asyncClientStreamingCall");
        }
        if (methodProto.getClientStreaming() && methodProto.getServerStreaming()) {
            methodContext.setReactiveCallsMethodName("manyToMany");
            methodContext.setGrpcCallsMethodName("asyncBidiStreamingCall");
        }
        return methodContext;
    }
construct the context

@param serviceProto
@param typeMap
@param locations
@param serviceNumber
@return
compiler/src/main/java/com/alipay/sofa/gen/base/AbstractGenerator.java