2 * Copyright (c) 2019 PANTHEON.tech 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.dom.codec.api;
10 import com.google.common.annotations.Beta;
11 import org.eclipse.jdt.annotation.NonNull;
12 import org.opendaylight.yangtools.concepts.Immutable;
13 import org.opendaylight.yangtools.yang.binding.BaseIdentity;
14 import org.opendaylight.yangtools.yang.common.QName;
17 * A codec capable of translating {@code identity} values between their YANG (QName) and Binding (Class) representation.
20 public interface BindingIdentityCodec extends Immutable {
22 * Convert a QNname to its corresponding Binding class.
24 * @param qname Identity QName
25 * @return A binding Class corresponding to the QName
26 * @throws IllegalArgumentException if the qname does not map to an identity
27 * @throws NullPointerException if qname is null
29 @NonNull Class<? extends BaseIdentity> toBinding(@NonNull QName qname);
32 * Concert a Binding class to its QName equivalent.
34 * @param bindingClass Binding class to convert
35 * @return QName corresponding to the binding class
36 * @throws NullPointerException if bindingClass is null
38 @NonNull QName fromBinding(Class<? extends BaseIdentity> bindingClass);