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.yang.binding.BaseIdentity;
13 import org.opendaylight.yangtools.yang.common.QName;
16 * A codec capable of translating {@code identity} values between their YANG (QName) and Binding (Class) representation.
19 public interface BindingIdentityCodec {
21 * Convert a QNname to its corresponding Binding class.
23 * @param qname Identity QName
24 * @return A binding Class corresponding to the QName
25 * @throws IllegalArgumentException if the qname does not map to an identity
26 * @throws NullPointerException if qname is null
28 @NonNull Class<? extends BaseIdentity> toBinding(@NonNull QName qname);
31 * Concert a Binding class to its QName equivalent.
33 * @param bindingClass Binding class to convert
34 * @return QName corresponding to the binding class
35 * @throws NullPointerException if bindingClass is null
37 @NonNull QName fromBinding(Class<? extends BaseIdentity> bindingClass);