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();
}
* @return status of this node which represents the argument of the YANG
* <code>status</code> substatement
*/
- @Nonnull Status getStatus();
+ @NonNull Status getStatus();
}
}