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.yangtools.transform;
10 import com.google.common.base.Function;
11 import com.google.common.base.Preconditions;
13 import org.opendaylight.yangtools.yang.common.QName;
15 class QNameReplacementFunction implements Function<QName, QName> {
17 private final Map<QName, QName> mapping;
19 QNameReplacementFunction(Map<QName, QName> mapping) {
20 this.mapping = Preconditions.checkNotNull(mapping);
24 public QName apply(QName input) {
25 QName potential = mapping.get(input);
26 return potential != null ? potential : input;