Rename org.opendaylight.yangtools.yang.binding
[yangtools.git] / binding / binding-data-codec-api / src / main / java / org / opendaylight / mdsal / binding / dom / codec / api / BindingInstanceIdentifierCodec.java
1 /*
2  * Copyright (c) 2020 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.eclipse.jdt.annotation.Nullable;
13 import org.opendaylight.yangtools.binding.lib.DataObject;
14 import org.opendaylight.yangtools.binding.lib.InstanceIdentifier;
15 import org.opendaylight.yangtools.concepts.Immutable;
16 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
17
18 @Beta
19 public interface BindingInstanceIdentifierCodec extends Immutable {
20     /**
21      * Translates supplied {@link YangInstanceIdentifier} into an {@link InstanceIdentifier}, if possible.
22      *
23      * @param domPath YANG Instance Identifier
24      * @return Binding Instance Identifier, or null if the instance identifier is not representable.
25      * @throws NullPointerException if domPath is null
26      * @throws IllegalArgumentException if domPath is not valid.
27      */
28     // FIXME: Document MissingSchemaException being thrown?
29     // FIXME: Document MissingSchemaForClassException being thrown?
30     <T extends DataObject> @Nullable InstanceIdentifier<T> toBinding(@NonNull YangInstanceIdentifier domPath);
31
32     /**
33      * Translates supplied {@link InstanceIdentifier} into {@link YangInstanceIdentifier}.
34      *
35      * @param bindingPath Binding Instance Identifier
36      * @return DOM Instance Identifier
37      * @throws NullPointerException if bindingPath is null
38      * @throws IllegalArgumentException if bindingPath is not valid.
39      */
40     // FIXME: Document MissingSchemaException being thrown
41     // FIXME: Document MissingSchemaForClassException being thrown
42     @NonNull YangInstanceIdentifier fromBinding(@NonNull InstanceIdentifier<?> bindingPath);
43 }