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.BaseIdentity;
11 import org.opendaylight.yangtools.yang.binding.NotificationListener;
12 import org.opendaylight.yangtools.yang.binding.RpcService;
14 public final class RuntimeCodeSpecification {
15 public final static String DIRECT_PROXY_SUFFIX = "DirectProxy";
16 public final static String INVOKER_SUFFIX = "ListenerInvoker";
17 public final static String ROUTER_SUFFIX = "Router";
19 public final static String DELEGATE_FIELD = "_delegate";
20 public final static String ROUTING_TABLE_FIELD_PREFIX = "_routes_";
22 private RuntimeCodeSpecification() {
23 throw new UnsupportedOperationException("Utility class");
27 * Returns a name for generated interface
29 private static String getGeneratedName(final Class<? extends Object> cls, final String suffix) {
30 return cls.getName() + "$$Broker$" + suffix;
33 public static String getInvokerName(final Class<? extends NotificationListener> listener) {
34 return getGeneratedName(listener, RuntimeCodeSpecification.INVOKER_SUFFIX);
38 * Returns a name for DirectProxy implementation
40 public static String getDirectProxyName(final Class<? extends RpcService> base) {
41 return getGeneratedName(base, RuntimeCodeSpecification.DIRECT_PROXY_SUFFIX);
45 * Returns a name for Router implementation
47 public static String getRouterName(final Class<? extends RpcService> base) {
48 return getGeneratedName(base, RuntimeCodeSpecification.ROUTER_SUFFIX);
52 * Returns a field name for specified routing context
54 public static String getRoutingTableField(final Class<? extends BaseIdentity> routingContext) {
55 return "_routes_" + routingContext.getSimpleName();