2 * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
8 package org.opendaylight.controller.sal.binding.codegen
10 import org.opendaylight.yangtools.yang.binding.RpcService
11 import org.opendaylight.yangtools.yang.binding.BaseIdentity
12 import org.opendaylight.yangtools.yang.binding.NotificationListener
18 class RuntimeCodeSpecification {
20 //public static val PACKAGE_PREFIX = "_gen.";
22 public static val DIRECT_PROXY_SUFFIX = "DirectProxy";
23 public static val ROUTER_SUFFIX = "Router";
24 public static val INVOKER_SUFFIX = "ListenerInvoker";
26 public static val DELEGATE_FIELD = "_delegate"
27 public static val ROUTING_TABLE_FIELD_PREFIX = "_routes_"
29 public static def getInvokerName(Class<? extends NotificationListener> listener) {
30 getGeneratedName(listener, INVOKER_SUFFIX);
34 * Returns a name for DirectProxy implementation
38 public static def getDirectProxyName(Class<? extends RpcService> base) {
39 getGeneratedName(base, DIRECT_PROXY_SUFFIX);
43 * Returns a name for Router implementation
46 public static def getRouterName(Class<? extends RpcService> base) {
47 getGeneratedName(base, ROUTER_SUFFIX);
51 * Returns a name for generated interface
54 public static def getGeneratedName(Class<?> cls, String suffix) {
55 '''«cls.name»$$Broker$«suffix»'''.toString()
59 * Returns a field name for specified routing context
62 public static def getRoutingTableField(Class<? extends BaseIdentity> routingContext) {
63 return '''_routes_«routingContext.simpleName»'''.toString;