Split ound mdsal-binding-dom-codec-api
[mdsal.git] / binding / mdsal-binding-dom-codec-api / src / main / java / org / opendaylight / mdsal / binding / dom / codec / api / BindingIdentityCodec.java
1 /*
2  * Copyright (c) 2019 PANTHEON.tech s.r.o. and others. All rights reserved.
3  *
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
7  */
8 package org.opendaylight.mdsal.binding.dom.codec.api;
9
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;
14
15 /**
16  * A codec capable of translating {@code identity} values between their YANG (QName) and Binding (Class) representation.
17  */
18 @Beta
19 public interface BindingIdentityCodec {
20     /**
21      * Convert a QNname to its corresponding Binding class.
22      *
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
27      */
28     @NonNull Class<? extends BaseIdentity> toBinding(@NonNull QName qname);
29
30     /**
31      * Concert a Binding class to its QName equivalent.
32      *
33      * @param bindingClass Binding class to convert
34      * @return QName corresponding to the binding class
35      * @throws NullPointerException if bindingClass is null
36      */
37     @NonNull QName fromBinding(Class<? extends BaseIdentity> bindingClass);
38 }