YANG augment listener
Change-Id: I11ece665a7627d784f82247d5a33e3453632d0f9
diff --git a/src/main/java/org/onosproject/yangutils/datamodel/YangAugment.java b/src/main/java/org/onosproject/yangutils/datamodel/YangAugment.java
index b2bd1ef..efe2561 100644
--- a/src/main/java/org/onosproject/yangutils/datamodel/YangAugment.java
+++ b/src/main/java/org/onosproject/yangutils/datamodel/YangAugment.java
@@ -22,6 +22,8 @@
import org.onosproject.yangutils.parser.Parsable;
import org.onosproject.yangutils.utils.YangConstructType;
+import static org.onosproject.yangutils.datamodel.utils.DataModelUtils.detectCollidingChildUtil;
+
/*-
* Reference RFC 6020.
*
@@ -77,12 +79,12 @@
* Data model node to maintain information defined in YANG augment.
*/
public class YangAugment extends YangNode
- implements YangLeavesHolder, YangCommonInfo, Parsable {
+ implements YangLeavesHolder, YangCommonInfo, Parsable, CollisionDetector {
/**
* Augment target node.
*/
- private String targetNode;
+ private String name;
/**
* Description of augment.
@@ -100,6 +102,11 @@
private List<YangLeafList> listOfLeafList;
/**
+ * List of node identifiers.
+ */
+ private List<YangNodeIdentifier> targetNode;
+
+ /**
* Reference of the YANG augment.
*/
private String reference;
@@ -121,17 +128,17 @@
*
* @return the augmented node
*/
- public String getTargetNode() {
+ public List<YangNodeIdentifier> getTargetNode() {
return targetNode;
}
/**
* Set the augmented node.
*
- * @param targetNode the augmented node
+ * @param nodeIdentifiers the augmented node
*/
- public void setTargetNode(String targetNode) {
- this.targetNode = targetNode;
+ public void setTargetNode(List<YangNodeIdentifier> nodeIdentifiers) {
+ this.targetNode = nodeIdentifiers;
}
/**
@@ -154,6 +161,20 @@
this.description = description;
}
+ @Override
+ public void detectCollidingChild(String identifierName, YangConstructType dataType) throws DataModelException {
+ // Detect colliding child.
+ detectCollidingChildUtil(identifierName, dataType, this);
+ }
+
+ @Override
+ public void detectSelfCollision(String identifierName, YangConstructType dataType) throws DataModelException {
+ if (this.getName().equals(identifierName)) {
+ throw new DataModelException("YANG file error: Duplicate input identifier detected, same as input \""
+ + this.getName() + "\"");
+ }
+ }
+
/**
* Get the list of leaves.
*
@@ -297,7 +318,7 @@
*/
@Override
public String getName() {
- return targetNode;
+ return name;
}
/**
@@ -307,7 +328,7 @@
*/
@Override
public void setName(String name) {
- targetNode = name;
+ this.name = name;
}