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%2FDeviation.java;h=f9b31d3e2ce9c4ae8241486277e96b6dad2b526d;hb=refs%2Fchanges%2F21%2F94321%2F1;hp=69a920a6c5d27653babd646a5c5dc0355932a32e;hpb=32438a2739795793f393c872a76a43444db7b46a;p=yangtools.git diff --git a/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/Deviation.java b/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/Deviation.java index 69a920a6c5..f9b31d3e2c 100644 --- a/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/Deviation.java +++ b/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/Deviation.java @@ -7,61 +7,32 @@ */ package org.opendaylight.yangtools.yang.model.api; -import com.google.common.base.Preconditions; -import java.util.List; +import java.util.Collection; +import org.eclipse.jdt.annotation.NonNull; +import org.opendaylight.yangtools.yang.model.api.stmt.DeviationEffectiveStatement; +import org.opendaylight.yangtools.yang.model.api.stmt.SchemaNodeIdentifier.Absolute; /** * Interface describing YANG 'deviation' statement. + * *

- * The 'deviation' statement defines a hierarchy of a module that the device - * does not implement faithfully. Deviations define the way a device deviate - * from a standard. - *

+ * The 'deviation' statement defines a hierarchy of a module that the device does not implement faithfully. Deviations + * define the way a device deviate from a standard. */ -public interface Deviation { - +public interface Deviation extends DocumentedNode, EffectiveStatementEquivalent { /** - * Enum describing YANG deviation 'deviate' statement. It defines how the - * device's implementation of the target node deviates from its original - * definition. + * Returns target node absolute schema node identifier. + * + * @return An identifier that points to the node in the schema tree where a deviation from the module occurs. */ - enum Deviate { - NOT_SUPPORTED("not-supported"), ADD("add"), REPLACE("replace"), DELETE("delete"); - - private final String keyword; - - private Deviate(final String keyword) { - this.keyword = Preconditions.checkNotNull(keyword); - } - - /** - * @return String that corresponds to the yang keyword. - */ - public String getKeyword() { - return keyword; - } + default @NonNull Absolute getTargetPath() { + return asEffectiveStatement().argument(); } /** - * @return SchemaPath that identifies the node in the schema tree where a - * deviation from the module occurs. - */ - SchemaPath getTargetPath(); - - /** - * @return deviate statement of this deviation + * Returns deviate children. + * + * @return Collection of all deviate statements defined in this deviation. */ - Deviate getDeviate(); - - /** - * @return textual cross-reference to an external document that provides - * additional information relevant to this node. - */ - String getReference(); - - /** - * @return collection of all unknown nodes defined under this schema node. - */ - List getUnknownSchemaNodes(); - + @NonNull Collection getDeviates(); }