Skip to content

Commit

Permalink
address PR feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
vam-google committed Jul 12, 2021
1 parent 7d1b833 commit 5db2998
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -137,8 +137,7 @@ protected MethodDefinition createUnaryCallableMethod(TypeStore typeStore) {
/*callSettingsVariantName=*/ methodVariantName,
/*callSettingsTemplateObjects=*/ methodTemplateNames.stream()
.map(n -> (Object) n)
.collect(Collectors.toList()),
Collections.emptyList());
.collect(Collectors.toList()));
}

protected MethodDefinition createPagedCallableMethod(TypeStore typeStore) {
Expand All @@ -160,8 +159,7 @@ protected MethodDefinition createPagedCallableMethod(TypeStore typeStore) {
/*callSettingsVariantName=*/ methodVariantName,
/*callSettingsTemplateObjects=*/ methodTemplateNames.stream()
.map(n -> (Object) n)
.collect(Collectors.toList()),
Collections.emptyList());
.collect(Collectors.toList()));
}

protected MethodDefinition createBatchingCallableMethod(TypeStore typeStore) {
Expand All @@ -181,12 +179,32 @@ protected MethodDefinition createBatchingCallableMethod(TypeStore typeStore) {
/*callSettingsVariantName=*/ methodVariantName,
/*callSettingsTemplateObjects=*/ methodTemplateNames.stream()
.map(n -> (Object) n)
.collect(Collectors.toList()),
Collections.emptyList());
.collect(Collectors.toList()));
}

protected abstract MethodDefinition createOperationCallableMethod(TypeStore typeStore);

protected MethodDefinition createGenericCallableMethod(
TypeStore typeStore,
List<String> methodTemplateNames,
String returnCallableKindName,
List<String> returnCallableTemplateNames,
String methodVariantName,
List<Object> transportCallSettingsTemplateObjects,
String callSettingsVariantName,
List<Object> callSettingsTemplateObjects) {
return createGenericCallableMethod(
typeStore,
methodTemplateNames,
returnCallableKindName,
returnCallableTemplateNames,
methodVariantName,
transportCallSettingsTemplateObjects,
callSettingsVariantName,
callSettingsTemplateObjects,
Collections.emptyList());
}

protected MethodDefinition createGenericCallableMethod(
TypeStore typeStore,
List<String> methodTemplateNames,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
import com.google.longrunning.Operation;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.stream.Collectors;

Expand Down Expand Up @@ -73,8 +72,7 @@ protected MethodDefinition createUnaryCallableMethod(TypeStore typeStore) {
/*callSettingsVariantName=*/ methodVariantName,
/*callSettingsTemplateObjects=*/ methodTemplateNames.stream()
.map(n -> (Object) n)
.collect(Collectors.toList()),
Collections.emptyList());
.collect(Collectors.toList()));
}

protected MethodDefinition createPagedCallableMethod(TypeStore typeStore) {
Expand All @@ -96,8 +94,7 @@ protected MethodDefinition createPagedCallableMethod(TypeStore typeStore) {
/*callSettingsVariantName=*/ methodVariantName,
/*callSettingsTemplateObjects=*/ methodTemplateNames.stream()
.map(n -> (Object) n)
.collect(Collectors.toList()),
Collections.emptyList());
.collect(Collectors.toList()));
}

@Override
Expand All @@ -117,8 +114,7 @@ protected MethodDefinition createOperationCallableMethod(TypeStore typeStore) {
/*callSettingsVariantName=*/ methodVariantName,
/*callSettingsTemplateObjects=*/ methodTemplateNames.stream()
.map(n -> (Object) n)
.collect(Collectors.toList()),
Collections.emptyList());
.collect(Collectors.toList()));
}

private MethodDefinition createBidiStreamingCallableMethod(TypeStore typeStore) {
Expand All @@ -138,8 +134,7 @@ private MethodDefinition createBidiStreamingCallableMethod(TypeStore typeStore)
/*callSettingsVariantName=*/ "Streaming",
/*callSettingsTemplateObjects=*/ methodTemplateNames.stream()
.map(n -> (Object) n)
.collect(Collectors.toList()),
Collections.emptyList());
.collect(Collectors.toList()));
}

private MethodDefinition createServerStreamingCallableMethod(TypeStore typeStore) {
Expand All @@ -159,8 +154,7 @@ private MethodDefinition createServerStreamingCallableMethod(TypeStore typeStore
/*callSettingsVariantName=*/ methodVariantName,
/*callSettingsTemplateObjects=*/ methodTemplateNames.stream()
.map(n -> (Object) n)
.collect(Collectors.toList()),
Collections.emptyList());
.collect(Collectors.toList()));
}

private MethodDefinition createClientStreamingCallableMethod(TypeStore typeStore) {
Expand All @@ -180,7 +174,6 @@ private MethodDefinition createClientStreamingCallableMethod(TypeStore typeStore
/*callSettingsVariantName=*/ "Streaming",
/*callSettingsTemplateObjects=*/ methodTemplateNames.stream()
.map(n -> (Object) n)
.collect(Collectors.toList()),
Collections.emptyList());
.collect(Collectors.toList()));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ protected List<AnnotationNode> createClassAnnotations(Service service, TypeStore
// Always add @BetaApi annotation to the generated CallableFactory for now. It is a public class
// for technical reasons, end users are not expected to interact with it, but it may change
// when we add LRO support, that is why making it @BetaApi for now.
//
// Remove the @BetaApi annotation once the LRO feature is fully implemented and stabilized.
if (annotations.stream().noneMatch(a -> a.type().equals(typeStore.get("BetaApi")))) {
annotations.add(AnnotationNode.withType(typeStore.get("BetaApi")));
}
Expand All @@ -78,8 +80,10 @@ protected MethodDefinition createOperationCallableMethod(TypeStore typeStore) {
List<String> methodTemplateNames =
Arrays.asList(requestTemplateName, responseTemplateName, "MetadataT");

// Always add @BetaApi annotation to the generated createOperationCallable()method for now,
// Always add @BetaApi annotation to the generated createOperationCallable() method for now,
// until LRO is fully implemented.
//
// Remove the @BetaApi annotation once the LRO feature is fully implemented and stabilized.
AnnotationNode betaAnnotation =
AnnotationNode.withTypeAndDescription(
typeStore.get("BetaApi"),
Expand Down

0 comments on commit 5db2998

Please sign in to comment.