From: Robert Varga Date: Tue, 26 Jul 2016 21:14:25 +0000 (+0200) Subject: Move Leaf(List)SchemaNode.getType() to a common interface X-Git-Tag: release/boron~40 X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=commitdiff_plain;h=542cb03c2edb5f40cca84949c2c1270c2dce0225;p=yangtools.git Move Leaf(List)SchemaNode.getType() to a common interface This helps users such as the Java Binding implementation. Change-Id: Iec2b47f6b6e5974e506edc25905c3a77ee167565 Signed-off-by: Robert Varga --- diff --git a/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/LeafListSchemaNode.java b/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/LeafListSchemaNode.java index 99ad7fc503..e6d96902b6 100644 --- a/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/LeafListSchemaNode.java +++ b/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/LeafListSchemaNode.java @@ -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 DataSchemaNode - * . - * - * @return type definition of leaf-list schema node which represents the - * value of the argument of the YANG type substatement - * of the leaf-list statement - */ - 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(); - } diff --git a/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/LeafSchemaNode.java b/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/LeafSchemaNode.java index 3a3f2d91a8..21dae7eeed 100644 --- a/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/LeafSchemaNode.java +++ b/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/LeafSchemaNode.java @@ -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. *

*/ -public interface LeafSchemaNode extends DataSchemaNode { - - /** - * Returns the YANG type of the instance of the type - * LeafSchemaNode. - * - * @return type definition which represents the value of the YANG - * type substatement for leaf statement - */ - TypeDefinition getType(); - +public interface LeafSchemaNode extends TypedSchemaNode { /** * Returns the default value of YANG leaf. * 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 index 0000000000..2b344464f0 --- /dev/null +++ b/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/TypedSchemaNode.java @@ -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 DataSchemaNode. + * + * @return type definition of leaf-list schema node which represents the + * value of the argument of the YANG type substatement + * of the leaf or leaf-list statement + */ + TypeDefinition> getType(); +}