-
Notifications
You must be signed in to change notification settings - Fork 53
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[ggj][codegen] feat: add comments for GrpcServiceCallableFactory, Grp…
…cServiceStub, ServiceStub (#276) * feat: parse batching descriptor fields * feat: add Field.isMap and map-parsing test * feat: add initial batching descriptor field to ServiceStubSettings * feat: support '? extends Foo' wildcard bounded references * fix: speed up precommit checks with --disk_cache * feat: add splitException, count{Elements,Bytes} batching descriptor methods to ServiceStubSettings * feat: add GeneralForStatement * feat: add splitRseponse to batching desc. in ServiceStubSettings * fix: output srcjar path * feat: add method comments to ServiceStubSettings, fix AST formatting * feat: add class Javadoc to ServiceStubSettings * feat: add class Javadoc to ServiceStubSettings * feat: add comments to ServiceSettings * fix: file move * feat: add comments for GrpcServiceCallableFactory, GrpcServiceStub, ServiceStub
- Loading branch information
Showing
7 changed files
with
90 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
65 changes: 65 additions & 0 deletions
65
src/main/java/com/google/api/generator/gapic/composer/StubComentComposer.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
// Copyright 2020 Google LLC | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
package com.google.api.generator.gapic.composer; | ||
|
||
import com.google.api.generator.engine.ast.CommentStatement; | ||
import com.google.api.generator.engine.ast.JavaDocComment; | ||
import java.util.Arrays; | ||
import java.util.List; | ||
|
||
class StubCommentComposer { | ||
private static final String STUB_CLASS_HEADER_SUMMARY_PATTERN = | ||
"Base stub class for the %s service API."; | ||
private static final String GRPC_CALLABLE_FACTORY_CLASS_HEADER_SUMMARY_PATTERN = | ||
"gRPC callable factory implementation for the %s service API."; | ||
private static final String GRPC_STUB_CLASS_HEADER_SUMMARY_PATTERN = | ||
"gRPC stub implementation for the %s service API."; | ||
|
||
private static final String ADVANCED_USAGE_DESCRIPTION = "This class is for advanced usage."; | ||
private static final String ADVANCED_USAGE_API_REFLECTION_DESCRIPTION = | ||
"This class is for advanced usage and reflects the underlying API directly."; | ||
|
||
static List<CommentStatement> createGrpcServiceStubClassHeaderComments(String serviceName) { | ||
return Arrays.asList( | ||
CommentComposer.AUTO_GENERATED_CLASS_COMMENT, | ||
CommentStatement.withComment( | ||
JavaDocComment.builder() | ||
.addComment(String.format(GRPC_STUB_CLASS_HEADER_SUMMARY_PATTERN, serviceName)) | ||
.addParagraph(ADVANCED_USAGE_API_REFLECTION_DESCRIPTION) | ||
.build())); | ||
} | ||
|
||
static List<CommentStatement> createGrpcServiceCallableFactoryClassHeaderComments( | ||
String serviceName) { | ||
return Arrays.asList( | ||
CommentComposer.AUTO_GENERATED_CLASS_COMMENT, | ||
CommentStatement.withComment( | ||
JavaDocComment.builder() | ||
.addComment( | ||
String.format(GRPC_CALLABLE_FACTORY_CLASS_HEADER_SUMMARY_PATTERN, serviceName)) | ||
.addParagraph(ADVANCED_USAGE_DESCRIPTION) | ||
.build())); | ||
} | ||
|
||
static List<CommentStatement> createServiceStubClassHeaderComments(String serviceName) { | ||
return Arrays.asList( | ||
CommentComposer.AUTO_GENERATED_CLASS_COMMENT, | ||
CommentStatement.withComment( | ||
JavaDocComment.builder() | ||
.addComment(String.format(STUB_CLASS_HEADER_SUMMARY_PATTERN, serviceName)) | ||
.addParagraph(ADVANCED_USAGE_API_REFLECTION_DESCRIPTION) | ||
.build())); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters