X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=yang%2Fyang-model-api%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fyangtools%2Fyang%2Fmodel%2Fapi%2FDocumentedNode.java;h=6fe4a293bcec65de4ee059d7d92cd998a355a27d;hb=29fb90116883182758dc9ec67cfcf1344a3cf951;hp=36acbe9b5168c770bbff5558bf1d736b065bafea;hpb=70388c194b80c4b17fdf86eba32862f9cfec9d69;p=yangtools.git diff --git a/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/DocumentedNode.java b/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/DocumentedNode.java index 36acbe9b51..6fe4a293bc 100644 --- a/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/DocumentedNode.java +++ b/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/DocumentedNode.java @@ -7,38 +7,45 @@ */ package org.opendaylight.yangtools.yang.model.api; +import com.google.common.collect.ImmutableList; +import java.util.Collection; +import java.util.Optional; +import org.eclipse.jdt.annotation.NonNull; + /** - * * Node which can have documentation assigned. - * */ public interface DocumentedNode { - /** - * Returns description of the instance of the type SchemaNode + * Returns the value of the argument of YANG description keyword. * - * @return string with textual description the node which represents the - * argument of the YANG description substatement + * @return string with the description, or empty if description was not provided. */ - String getDescription(); + Optional getDescription(); /** - * Returns reference of the instance of the type SchemaNode - * - * The reference refers to external document that provides additional - * information relevant for the instance of this type. + * Returns the value of the argument of YANG reference keyword. * - * @return string with the reference to some external document which - * represents the argument of the YANG reference - * substatement + * @return string with reference to some other document, or empty if reference was not provided. */ - String getReference(); + Optional getReference(); /** - * Returns status of the instance of the type SchemaNode + * Returns unknown schema nodes which belongs to this instance. Default implementation returns an empty collection. * - * @return status of this node which represents the argument of the YANG - * status substatement + * @return collection of unknown schema nodes defined under this node. */ - Status getStatus(); + default @NonNull Collection getUnknownSchemaNodes() { + return ImmutableList.of(); + } + + interface WithStatus extends DocumentedNode { + /** + * Returns status of the instance of the type SchemaNode. + * + * @return status of this node which represents the argument of the YANG + * status substatement + */ + @NonNull Status getStatus(); + } }