2 * Copyright (c) 2017 Pantheon Technologies s.r.o. 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.javav2.dom.adapter.impl.operation.invoker;
10 import com.google.common.annotations.Beta;
11 import com.google.common.base.Preconditions;
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;
20 final class LocalNameOperationServiceInvoker extends AbstractMappedOperationInvoker<String> {
21 private final QNameModule module;
23 private LocalNameOperationServiceInvoker(final QNameModule module, final Map<String, Method> map) {
25 this.module = Preconditions.checkNotNull(module);
28 static OperationServiceInvoker instanceFor(final QNameModule module, final Map<QName, Method> qnameToMethod) {
29 final Map<String, Method> map = new HashMap<>();
30 for (final Entry<QName, Method> e : qnameToMethod.entrySet()) {
31 map.put(e.getKey().getLocalName(), e.getValue());
33 return new LocalNameOperationServiceInvoker(module, map);
37 protected String qnameToKey(final QName qname) {
38 if (module.equals(qname.getModule())) {
39 return qname.getLocalName();