BUG-6533: add immutable implementations of yang.model.api
[yangtools.git] / yang / yang-model-api / src / main / java / org / opendaylight / yangtools / yang / model / api / DocumentedNode.java
1 /*
2  * Copyright (c) 2014 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 package org.opendaylight.yangtools.yang.model.api;
9
10 import com.google.common.collect.ImmutableList;
11 import java.util.List;
12 import javax.annotation.Nonnull;
13 import javax.annotation.Nullable;
14
15 /**
16  * Node which can have documentation assigned.
17  */
18 public interface DocumentedNode {
19
20     /**
21      * All implementations should override this method.
22      * The default definition of this method is used only in YANG 1.0 (RFC6020) implementations of
23      * ModuleImport which do not allow a description statement.
24      * YANG import statement has been changed in YANG 1.1 (RFC7950) and can now contain a description statement.
25      *
26      * @return string that represents the argument of description statement
27      */
28     // FIXME: version 2.0.0: make this method non-default
29     @Nullable default String getDescription() {
30         return null;
31     }
32
33     /**
34      * All implementations should override this method.
35      * The default definition of this method is used only in YANG 1.0 (RFC6020) implementations of
36      * ModuleImport which do not allow a reference statement.
37      * YANG import statement has been changed in YANG 1.1 (RFC7950) and can now contain a reference statement.
38      *
39      * @return string that represents the argument of reference statement
40      */
41     // FIXME: version 2.0.0: make this method non-default
42     @Nullable default String getReference() {
43         return null;
44     }
45
46     /**
47      * Returns unknown schema nodes which belongs to this instance.
48      *
49      * @return list of unknown schema nodes defined under this node.
50      */
51     default @Nonnull List<UnknownSchemaNode> getUnknownSchemaNodes() {
52         return ImmutableList.of();
53     }
54
55     interface WithStatus extends DocumentedNode {
56
57         /**
58          * Returns status of the instance of the type <code>SchemaNode</code>
59          *
60          * @return status of this node which represents the argument of the YANG
61          *         <code>status</code> substatement
62          */
63         @Nonnull Status getStatus();
64     }
65 }