- ]
- return targetCls.toClass(iface.classLoader).newInstance as T
- ];
- return new RpcRouterCodegenInstance(iface, instance, contexts);
- }
-
- protected def generateListenerInvoker(Class<? extends NotificationListener> iface) {
- val callbacks = iface.methods.filter[notificationCallback]
-
- val supportedNotification = callbacks.map[parameterTypes.get(0) as Class<? extends Notification>].toSet;
-
- val targetCls = createClass(iface.invokerName,BROKER_NOTIFICATION_LISTENER ) [
- field(DELEGATE_FIELD, iface)
- implementMethodsFrom(BROKER_NOTIFICATION_LISTENER) [
- body = '''
- {
- «FOR callback : callbacks SEPARATOR " else "»
- «val cls = callback.parameterTypes.get(0).name»
- if($1 instanceof «cls») {
- «DELEGATE_FIELD».«callback.name»((«cls») $1);
- return null;
+ implementMethodsFrom(RpcImplementation.asCtClass) [
+ switch (name) {
+ case "getSupportedInputs":
+ body = '''
+ {
+ throw new java.lang.UnsupportedOperationException("Not implemented yet");
+ return ($r) null;
+ }'''
+ case "invoke": {
+ val tmpBody = '''
+ {
+ «FOR input : metadata.supportedInputs SEPARATOR " else "»
+ «val rpcMetadata = metadata.rpcInputs.get(input)»
+ if(«input.name».class.equals($1)) {
+ return ($r) this.«rpcMetadata.methodName»((«input.name») $2);
+ }
+ «ENDFOR»
+ throw new java.lang.IllegalArgumentException("Not supported message type");
+ return ($r) null;