/** * Creates an instance of GrpcStreamingConfig for gRPC response streaming from the given Grpc * method. On errors, null will be returned, and diagnostics are reported to the diag collector. */ @Nullable public static GrpcStreamingConfig createGrpcStreaming( DiagCollector diagCollector, Method method) { GrpcStreamingType type = getGrpcStreamingType(diagCollector, method); if (type == null) { return null; } return new GrpcStreamingConfig(null, type); }
/** * Creates an instance of GrpcStreamingConfig for gRPC response streaming, based on * PageStreamingConfigProto, linking it up with the provided method. On errors, null will be * returned, and diagnostics are reported to the diag collector. * * <p>TODO: Create a separate GrpcStreamingConfigProto */ @Nullable public static GrpcStreamingConfig createGrpcStreaming( DiagCollector diagCollector, PageStreamingConfigProto pageStreaming, Method method) { String resourcesFieldName = pageStreaming.getResponse().getResourcesField(); Field resourcesField = method.getOutputType().getMessageType().lookupField(resourcesFieldName); GrpcStreamingType type = getGrpcStreamingType(diagCollector, method); if (type == null) { return null; } return new GrpcStreamingConfig(resourcesField, type); }