2 * Copyright (c) 2015 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.mdsal.binding.dom.adapter.invoke;
10 import static java.util.Objects.requireNonNull;
12 import java.lang.reflect.Method;
13 import java.util.HashMap;
15 import java.util.Map.Entry;
16 import org.opendaylight.yangtools.yang.common.QName;
17 import org.opendaylight.yangtools.yang.common.QNameModule;
19 final class LocalNameRpcServiceInvoker extends AbstractMappedRpcInvoker<String> {
20 private final QNameModule module;
22 private LocalNameRpcServiceInvoker(final QNameModule module, final Map<String, Method> map) {
24 this.module = requireNonNull(module);
27 static RpcServiceInvoker instanceFor(final QNameModule module, final Map<QName, Method> qnameToMethod) {
28 final Map<String, Method> map = new HashMap<>();
29 for (Entry<QName, Method> e : qnameToMethod.entrySet()) {
30 map.put(e.getKey().getLocalName(), e.getValue());
33 return new LocalNameRpcServiceInvoker(module, map);
37 protected String qnameToKey(final QName qname) {
38 if (module.equals(qname.getModule())) {
39 return qname.getLocalName();