Skip to content
Snippets Groups Projects
Commit 6f950109 authored by Makarand Dharmapurikar's avatar Makarand Dharmapurikar
Browse files

fix for issue 5548. Deprecated old classes and created subclasses.

parent d30d4e27
No related branches found
No related tags found
No related merge requests found
...@@ -94,7 +94,7 @@ void PrintSimpleSignature(Printer *printer, const MethodDescriptor *method, ...@@ -94,7 +94,7 @@ void PrintSimpleSignature(Printer *printer, const MethodDescriptor *method,
void PrintAdvancedSignature(Printer *printer, const MethodDescriptor *method, void PrintAdvancedSignature(Printer *printer, const MethodDescriptor *method,
map< ::grpc::string, ::grpc::string> vars) { map< ::grpc::string, ::grpc::string> vars) {
vars["method_name"] = "RPCTo" + vars["method_name"]; vars["method_name"] = "RPCTo" + vars["method_name"];
vars["return_type"] = "ProtoRPC *"; vars["return_type"] = "GRPCProtoRPC *";
PrintMethodSignature(printer, method, vars); PrintMethodSignature(printer, method, vars);
} }
...@@ -199,7 +199,7 @@ void PrintMethodImplementations(Printer *printer, ...@@ -199,7 +199,7 @@ void PrintMethodImplementations(Printer *printer,
" marshalling and parsing.\n"); " marshalling and parsing.\n");
printer.Print(vars, printer.Print(vars,
"@interface $service_class$ :" "@interface $service_class$ :"
" ProtoService<$service_class$>\n"); " GRPCProtoService<$service_class$>\n");
printer.Print( printer.Print(
"- (instancetype)initWithHost:(NSString *)host" "- (instancetype)initWithHost:(NSString *)host"
" NS_DESIGNATED_INITIALIZER;\n"); " NS_DESIGNATED_INITIALIZER;\n");
......
...@@ -37,6 +37,7 @@ ...@@ -37,6 +37,7 @@
* A fully-qualified proto service method name. Full qualification is needed because a gRPC endpoint * A fully-qualified proto service method name. Full qualification is needed because a gRPC endpoint
* can implement multiple services. * can implement multiple services.
*/ */
__attribute__((deprecated("Please use GRPCProtoMethod.")))
@interface ProtoMethod : NSObject @interface ProtoMethod : NSObject
@property(nonatomic, readonly) NSString *package; @property(nonatomic, readonly) NSString *package;
@property(nonatomic, readonly) NSString *service; @property(nonatomic, readonly) NSString *service;
...@@ -48,3 +49,11 @@ ...@@ -48,3 +49,11 @@
service:(NSString *)service service:(NSString *)service
method:(NSString *)method; method:(NSString *)method;
@end @end
/**
* This subclass is empty now. Eventually we'll remove ProtoService class
* to avoid potential naming conflict
*/
@interface GRPCProtoMethod : ProtoMethod
@end
...@@ -53,3 +53,7 @@ ...@@ -53,3 +53,7 @@
} }
} }
@end @end
@implementation GRPCProtoMethod
@end
...@@ -36,13 +36,22 @@ ...@@ -36,13 +36,22 @@
#import "ProtoMethod.h" #import "ProtoMethod.h"
__attribute__((deprecated("Please use GRPCProtoRPC.")))
@interface ProtoRPC : GRPCCall @interface ProtoRPC : GRPCCall
- (instancetype)initWithHost:(NSString *)host - (instancetype)initWithHost:(NSString *)host
method:(ProtoMethod *)method method:(GRPCProtoMethod *)method
requestsWriter:(GRXWriter *)requestsWriter requestsWriter:(GRXWriter *)requestsWriter
responseClass:(Class)responseClass responseClass:(Class)responseClass
responsesWriteable:(id<GRXWriteable>)responsesWriteable NS_DESIGNATED_INITIALIZER; responsesWriteable:(id<GRXWriteable>)responsesWriteable NS_DESIGNATED_INITIALIZER;
- (void)start; - (void)start;
@end @end
/**
* This subclass is empty now. Eventually we'll remove ProtoService class
* to avoid potential naming conflict
*/
@interface GRPCProtoRPC : ProtoRPC
@end
...@@ -70,7 +70,7 @@ static NSError *ErrorForBadProto(id proto, Class expectedClass, NSError *parsing ...@@ -70,7 +70,7 @@ static NSError *ErrorForBadProto(id proto, Class expectedClass, NSError *parsing
// Designated initializer // Designated initializer
- (instancetype)initWithHost:(NSString *)host - (instancetype)initWithHost:(NSString *)host
method:(ProtoMethod *)method method:(GRPCProtoMethod *)method
requestsWriter:(GRXWriter *)requestsWriter requestsWriter:(GRXWriter *)requestsWriter
responseClass:(Class)responseClass responseClass:(Class)responseClass
responsesWriteable:(id<GRXWriteable>)responsesWriteable { responsesWriteable:(id<GRXWriteable>)responsesWriteable {
...@@ -117,3 +117,7 @@ static NSError *ErrorForBadProto(id proto, Class expectedClass, NSError *parsing ...@@ -117,3 +117,7 @@ static NSError *ErrorForBadProto(id proto, Class expectedClass, NSError *parsing
_responseWriteable = nil; _responseWriteable = nil;
} }
@end @end
@implementation GRPCProtoRPC
@end
...@@ -33,17 +33,28 @@ ...@@ -33,17 +33,28 @@
#import <Foundation/Foundation.h> #import <Foundation/Foundation.h>
@class ProtoRPC; @class GRPCProtoRPC;
@protocol GRXWriteable; @protocol GRXWriteable;
@class GRXWriter; @class GRXWriter;
__attribute__((deprecated("Please use GRPCProtoService.")))
@interface ProtoService : NSObject @interface ProtoService : NSObject
- (instancetype)initWithHost:(NSString *)host - (instancetype)initWithHost:(NSString *)host
packageName:(NSString *)packageName packageName:(NSString *)packageName
serviceName:(NSString *)serviceName NS_DESIGNATED_INITIALIZER; serviceName:(NSString *)serviceName NS_DESIGNATED_INITIALIZER;
- (ProtoRPC *)RPCToMethod:(NSString *)method - (GRPCProtoRPC *)RPCToMethod:(NSString *)method
requestsWriter:(GRXWriter *)requestsWriter requestsWriter:(GRXWriter *)requestsWriter
responseClass:(Class)responseClass responseClass:(Class)responseClass
responsesWriteable:(id<GRXWriteable>)responsesWriteable; responsesWriteable:(id<GRXWriteable>)responsesWriteable;
@end @end
/**
* This subclass is empty now. Eventually we'll remove ProtoService class
* to avoid potential naming conflict
*/
@interface GRPCProtoService : ProtoService
@end
...@@ -79,3 +79,7 @@ ...@@ -79,3 +79,7 @@
responsesWriteable:responsesWriteable]; responsesWriteable:responsesWriteable];
} }
@end @end
@implementation GRPCProtoService
@end
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment