Binding v2 runtime - adapters - impl - operations invoker
[mdsal.git] / binding2 / mdsal-binding2-spec / src / main / java / org / opendaylight / mdsal / binding / javav2 / spec / base / InstanceIdentifierBuilder.java
1 /*
2  * Copyright (c) 2017 Cisco Systems, Inc. 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
9 package org.opendaylight.mdsal.binding.javav2.spec.base;
10
11 import com.google.common.annotations.Beta;
12 import org.opendaylight.mdsal.binding.javav2.spec.structural.Augmentation;
13 import org.opendaylight.mdsal.binding.javav2.spec.structural.TreeChildNode;
14 import org.opendaylight.yangtools.concepts.Builder;
15
16 @Beta
17 public interface InstanceIdentifierBuilder<T extends TreeNode> extends Builder<InstanceIdentifier<T>> {
18     /**
19      * Append the specified container as a child of the current InstanceIdentifier referenced by the
20      * builder.
21      *
22      * This method should be used when you want to build an instance identifier by appending
23      * top-level elements
24      *
25      * Example,
26      *
27      * <pre>
28      * InstanceIdentifier.builder().child(Nodes.class).build();
29      *
30      * </pre>
31      *
32      * NOTE :- The above example is only for illustration purposes InstanceIdentifier.builder() has
33      * been deprecated and should not be used. Use InstanceIdentifier.builder(Nodes.class) instead
34      *
35      * @param container
36      * @param <N>
37      * @return
38      */
39     // FIXME: Why TreeNode needs to be explicitly mentioned, whern ChildTreeNode is derived from
40     // TreeNode?
41     <N extends TreeNode & TreeChildNode<? super T, Item<N>>> InstanceIdentifierBuilder<N> child(Class<N> container);
42
43     /**
44      * Append the specified listItem as a child of the current InstanceIdentifier referenced by the
45      * builder.
46      *
47      * This method should be used when you want to build an instance identifier by appending a
48      * specific list element to the identifier
49      *
50      * @param listItem
51      * @param listKey
52      * @param <N>
53      * @param <K>
54      * @return
55      */
56     <N extends TreeChildNode<? super T, ?>, K> InstanceIdentifierBuilder<N> child(Class<N> listItem, K listKey);
57
58     /**
59      * Build an identifier which refers to a specific augmentation of the current InstanceIdentifier
60      * referenced by the builder
61      *
62      * @param container
63      * @param <N>
64      * @return
65      */
66     <N extends TreeNode & Augmentation<? super T>> InstanceIdentifierBuilder<N> augmentation(Class<N> container);
67
68     /**
69      * Build the instance identifier.
70      *
71      * @return
72      */
73     @Override
74     InstanceIdentifier<T> build();
75
76     /*
77      * @deprecated use #build()
78      */
79     @Deprecated
80     InstanceIdentifier<T> toInstance();
81 }