@Override public String getApiMethodName(MethodModel method, VisibilityConfig visibility) { // This is defined in grpc/generic/service.rb return method .getSimpleName() .replaceAll("([A-Z]+)([A-Z][a-z])", "$1_$2") .replaceAll("([a-z\\d])([A-Z])", "$1_$2") .replaceAll("-", "_") .toLowerCase(); }
@Override public String getAndSaveOperationResponseTypeName( MethodModel method, ImportTypeTable typeTable, MethodConfig methodConfig) { return getAndSaveOperationResponseTypeName(method.getSimpleName()); }
/** Returns the GapicMethodConfig for the given method. */ @Override public GapicMethodConfig getMethodConfig(MethodModel method) { return getMethodConfig(method.getSimpleName()); }
@Override public void run() { Preconditions.checkArgument( !ran, "%s:%s: only one field of OutputSpec may be set", context.getMethodModel().getSimpleName(), valueSet.getId()); ran = true; } };
@Override /* The name of the settings member name for the given method. */ public String getOperationSettingsMemberName(MethodModel method) { return publicMethodName(Name.upperCamel(method.getSimpleName(), "OperationSettings")); }
/** The name used in Grpc for the given API method. This needs to match what Grpc generates. */ public String getGrpcMethodName(MethodModel method) { // This might seem silly, but it makes clear what we're dealing with (upper camel). // This is language-independent because of gRPC conventions. return Name.anyCamelKeepUpperAcronyms(method.getSimpleName()).toUpperCamel(); }
@Override public String getFixedSizeCollectionTypeInnerName( MethodModel method, ImportTypeTable typeTable, FieldModel resourceField) { return publicClassName(Name.anyCamel(method.getSimpleName(), "FixedSizeCollection")); }
@Override public String getPagedResponseTypeInnerName( MethodModel method, ImportTypeTable typeTable, FieldModel resourceField) { return publicClassName(Name.anyCamel(method.getSimpleName(), "PagedResponse")); }
@Override public String getPageTypeInnerName( MethodModel method, ImportTypeTable typeTable, FieldModel resourceField) { return publicClassName(Name.anyCamel(method.getSimpleName(), "Page")); }
@Override public String getPageStreamingDescriptorConstName(MethodModel method) { return inittedConstantName(Name.upperCamel(method.getSimpleName())); }
@Override public String getTestCaseName(SymbolTable symbolTable, MethodModel method) { Name testCaseName = symbolTable.getNewSymbol(Name.upperCamel("Test", method.getSimpleName())); return publicMethodName(testCaseName); }
@Override public String getExceptionTestCaseName(SymbolTable symbolTable, MethodModel method) { Name testCaseName = symbolTable.getNewSymbol(Name.upperCamel("Test", method.getSimpleName(), "Exception")); return publicMethodName(testCaseName); }
/** The name of the constant to hold the page streaming descriptor for the given method. */ public String getPageStreamingDescriptorConstName(MethodModel method) { return inittedConstantName(Name.anyCamel(method.getSimpleName()).join("page_str_desc")); }
/** The name of the constant to hold the page streaming factory for the given method. */ public String getPagedListResponseFactoryConstName(MethodModel method) { return inittedConstantName(Name.anyCamel(method.getSimpleName()).join("page_str_fact")); }
@Override public String getExceptionTestCaseName(SymbolTable symbolTable, MethodModel method) { Name testCaseName = symbolTable.getNewSymbol( Name.upperCamel("Test", method.getParentSimpleName(), method.getSimpleName(), "Error")); return publicMethodName(testCaseName); }
@Override public String getTestCaseName(SymbolTable symbolTable, MethodModel method) { Name testCaseName = symbolTable.getNewSymbol( Name.upperCamel("Test", method.getParentSimpleName(), method.getSimpleName())); return publicMethodName(testCaseName); }
@Override public List<String> getDocLines(MethodModel method, MethodConfig methodConfig) { return super.getDocLines( putDocMethodName( method.getSimpleName(), method.getDescription(), methodConfig.getVisibility())); }
@Override public String getStreamingServerName(MethodModel method) { // Unsafe string manipulation: The name looks like "LibraryService_StreamShelvesServer", // neither camel or underscore. return method.getParentNickname(converter) + "_" + publicClassName(Name.upperCamel(method.getSimpleName()).join("server")); }
private String getResourcesFieldName(MethodModel method, ConfigHelper helper) { FieldModel resourcesField = getResourcesField(method); if (resourcesField != null) { return resourcesField.getSimpleName(); } helper.error( method.getFullName(), "Page streaming resources field could not be heuristically determined for " + "method '%s'%n", method.getSimpleName()); return null; } }
@Override public String getGrpcStreamingApiReturnTypeName( MethodContext methodContext, ImportTypeTable typeTable) { // Unsafe string manipulation: The name looks like "LibraryService_StreamShelvesClient", // neither camel or underscore. MethodModel method = methodContext.getMethodModel(); return method.getParentNickname(converter) + "_" + publicClassName(Name.upperCamel(method.getSimpleName()).join("client")); }