Move Leaf(List)SchemaNode.getType() to a common interface 93/42593/3
authorRobert Varga <rovarga@cisco.com>
Tue, 26 Jul 2016 21:14:25 +0000 (23:14 +0200)
committerRobert Varga <nite@hq.sk>
Wed, 27 Jul 2016 18:06:20 +0000 (18:06 +0000)
This helps users such as the Java Binding implementation.

Change-Id: Iec2b47f6b6e5974e506edc25905c3a77ee167565
Signed-off-by: Robert Varga <rovarga@cisco.com>
yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/LeafListSchemaNode.java
yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/LeafSchemaNode.java
yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/TypedSchemaNode.java [new file with mode: 0644]

index 99ad7fc503482cf254b82eda0e045c5cac8b5c5e..e6d96902b6daeb17fd088172b8ac0dc1cdfdf209 100644 (file)
@@ -10,18 +10,7 @@ package org.opendaylight.yangtools.yang.model.api;
 /**
  * Interface describing YANG 'leaf-list' statement.
  */
-public interface LeafListSchemaNode extends DataSchemaNode {
-
-    /**
-     * Returns type of the instance which implements <code>DataSchemaNode</code>
-     * .
-     *
-     * @return type definition of leaf-list schema node which represents the
-     *         value of the argument of the YANG <code>type</code> substatement
-     *         of the <code>leaf-list</code> statement
-     */
-    TypeDefinition<? extends TypeDefinition<?>> getType();
-
+public interface LeafListSchemaNode extends TypedSchemaNode {
     /**
      * YANG 'ordered-by' statement. It defines whether the order of entries
      * within this leaf-list are determined by the user or the system. If not
@@ -30,5 +19,4 @@ public interface LeafListSchemaNode extends DataSchemaNode {
      * @return true if ordered-by argument is "user", false otherwise
      */
     boolean isUserOrdered();
-
 }
index 3a3f2d91a88e8d1668e5e7471c8f31972d3f33c7..21dae7eeed208ff4ba2b73b20b6584a189307217 100644 (file)
@@ -20,17 +20,7 @@ package org.opendaylight.yangtools.yang.model.api;
  * The 'leaf' statement is used to define a leaf node in the schema tree.
  * </p>
  */
-public interface LeafSchemaNode extends DataSchemaNode {
-
-    /**
-     * Returns the YANG <code>type</code> of the instance of the type
-     * <code>LeafSchemaNode</code>.
-     *
-     * @return type definition which represents the value of the YANG
-     *         <code>type</code> substatement for <code>leaf</code> statement
-     */
-    TypeDefinition<?> getType();
-
+public interface LeafSchemaNode extends TypedSchemaNode {
     /**
      * Returns the default value of YANG <code>leaf</code>.
      *
diff --git a/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/TypedSchemaNode.java b/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/TypedSchemaNode.java
new file mode 100644 (file)
index 0000000..2b34446
--- /dev/null
@@ -0,0 +1,25 @@
+/*
+ * Copyright (c) 2016 Cisco Systems, Inc. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.yangtools.yang.model.api;
+
+/**
+ * A {@link DataSchemaNode} which holds values of the same type. This can be either a single value, like
+ * in a {@link LeafSchemaNode} or multiple values, like a {@link LeafListSchemaNode}.
+ *
+ * @author Robert Varga
+ */
+public interface TypedSchemaNode extends DataSchemaNode {
+    /**
+     * Returns type of the instance which implements <code>DataSchemaNode</code>.
+     *
+     * @return type definition of leaf-list schema node which represents the
+     *         value of the argument of the YANG <code>type</code> substatement
+     *         of the <code>leaf</code> or <code>leaf-list</code> statement
+     */
+    TypeDefinition<? extends TypeDefinition<?>> getType();
+}