Un-deprecate CopyableNode, AddedByUsesAware
[yangtools.git] / yang / yang-model-api / src / main / java / org / opendaylight / yangtools / yang / model / api / DocumentedNode.java
index c375e02889b1c0d5dd9a471676bfa03a0e646c25..0d9b27f69ef29613961f6855feb96b374ba10e92 100644 (file)
@@ -8,46 +8,34 @@
 package org.opendaylight.yangtools.yang.model.api;
 
 import com.google.common.collect.ImmutableList;
-import java.util.List;
-import javax.annotation.Nonnull;
-import javax.annotation.Nullable;
+import java.util.Collection;
+import java.util.Optional;
+import org.eclipse.jdt.annotation.NonNull;
 
 /**
  * Node which can have documentation assigned.
  */
 public interface DocumentedNode {
     /**
-     * All implementations should override this method.
-     * The default definition of this method is used only in YANG 1.0 (RFC6020) implementations of
-     * ModuleImport which do not allow a description statement.
-     * YANG import statement has been changed in YANG 1.1 (RFC7950) and can now contain a description statement.
+     * Returns the value of the argument of YANG <code>description</code> keyword.
      *
-     * @return string that represents the argument of description statement
+     * @return string with the description, or empty if description was not provided.
      */
-    // FIXME: version 2.0.0: make this method non-default
-    @Nullable default String getDescription() {
-        return null;
-    }
+    Optional<String> getDescription();
 
     /**
-     * All implementations should override this method.
-     * The default definition of this method is used only in YANG 1.0 (RFC6020) implementations of
-     * ModuleImport which do not allow a reference statement.
-     * YANG import statement has been changed in YANG 1.1 (RFC7950) and can now contain a reference statement.
+     * Returns the value of the argument of YANG <code>reference</code> keyword.
      *
-     * @return string that represents the argument of reference statement
+     * @return string with reference to some other document, or empty if reference was not provided.
      */
-    // FIXME: version 2.0.0: make this method non-default
-    @Nullable default String getReference() {
-        return null;
-    }
+    Optional<String> getReference();
 
     /**
-     * Returns unknown schema nodes which belongs to this instance.
+     * Returns unknown schema nodes which belongs to this instance. Default implementation returns an empty collection.
      *
-     * @return list of unknown schema nodes defined under this node.
+     * @return collection of unknown schema nodes defined under this node.
      */
-    default @Nonnull List<UnknownSchemaNode> getUnknownSchemaNodes() {
+    default @NonNull Collection<? extends UnknownSchemaNode> getUnknownSchemaNodes() {
         return ImmutableList.of();
     }
 
@@ -58,6 +46,6 @@ public interface DocumentedNode {
          * @return status of this node which represents the argument of the YANG
          *         <code>status</code> substatement
          */
-        @Nonnull Status getStatus();
+        @NonNull Status getStatus();
     }
 }