[ONOS-3902, ONOS-3903, ONOS-3904] string type, integer type derrived type
Change-Id: I8279e93fcb7dfb82491cc09057c9d75165add68d
diff --git a/utils/yangutils/src/main/java/org/onosproject/yangutils/datamodel/YangAppErrorInfo.java b/utils/yangutils/src/main/java/org/onosproject/yangutils/datamodel/YangAppErrorInfo.java
new file mode 100644
index 0000000..9b3ba3f
--- /dev/null
+++ b/utils/yangutils/src/main/java/org/onosproject/yangutils/datamodel/YangAppErrorInfo.java
@@ -0,0 +1,47 @@
+/*Copyright 2016.year Open Networking Laboratory
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.*/
+package org.onosproject.yangutils.datamodel;
+
+/**
+ * Abstraction of error message and application info processing.
+ */
+public interface YangAppErrorInfo {
+ /**
+ * Get the application's error message for data error.
+ *
+ * @return application's error message for data error.
+ */
+ String getGetErrorMessage();
+
+ /**
+ * Set the application's error message for data error.
+ *
+ * @param errorMessage application's error message for data error.
+ */
+ void setErrorMessage(String errorMessage);
+
+ /**
+ * Get the application's error tag for data error.
+ *
+ * @return application's error tag for data error.
+ */
+ String getGetErrorAppTag();
+
+ /**
+ * Set the application's error tag for data error.
+ *
+ * @param errorMessage application's error tag for data error.
+ */
+ void setErrorAppTag(String errorMessage);
+}
diff --git a/utils/yangutils/src/main/java/org/onosproject/yangutils/datamodel/YangAugment.java b/utils/yangutils/src/main/java/org/onosproject/yangutils/datamodel/YangAugment.java
index 3f34922..378eaf4 100644
--- a/utils/yangutils/src/main/java/org/onosproject/yangutils/datamodel/YangAugment.java
+++ b/utils/yangutils/src/main/java/org/onosproject/yangutils/datamodel/YangAugment.java
@@ -92,12 +92,12 @@
/**
* List of leaves.
*/
- private List<YangLeaf<?>> listOfLeaf;
+ private List<YangLeaf> listOfLeaf;
/**
* List of leaf-lists.
*/
- private List<YangLeafList<?>> listOfLeafList;
+ private List<YangLeafList> listOfLeafList;
/**
* reference.
@@ -110,6 +110,11 @@
private YangStatusType status;
/**
+ * package of the generated java code.
+ */
+ private String pkg;
+
+ /**
* Create a YANG augment node.
*/
public YangAugment() {
@@ -160,7 +165,7 @@
* @return the list of leaves.
*/
@Override
- public List<YangLeaf<?>> getListOfLeaf() {
+ public List<YangLeaf> getListOfLeaf() {
return listOfLeaf;
}
@@ -169,7 +174,7 @@
*
* @param leafsList the list of leaf to set.
*/
- private void setListOfLeaf(List<YangLeaf<?>> leafsList) {
+ private void setListOfLeaf(List<YangLeaf> leafsList) {
listOfLeaf = leafsList;
}
@@ -179,9 +184,9 @@
* @param leaf the leaf to be added.
*/
@Override
- public void addLeaf(YangLeaf<?> leaf) {
+ public void addLeaf(YangLeaf leaf) {
if (getListOfLeaf() == null) {
- setListOfLeaf(new LinkedList<YangLeaf<?>>());
+ setListOfLeaf(new LinkedList<YangLeaf>());
}
getListOfLeaf().add(leaf);
@@ -193,7 +198,7 @@
* @return the list of leaf-list.
*/
@Override
- public List<YangLeafList<?>> getListOfLeafList() {
+ public List<YangLeafList> getListOfLeafList() {
return listOfLeafList;
}
@@ -202,7 +207,7 @@
*
* @param listOfLeafList the list of leaf-list to set.
*/
- private void setListOfLeafList(List<YangLeafList<?>> listOfLeafList) {
+ private void setListOfLeafList(List<YangLeafList> listOfLeafList) {
this.listOfLeafList = listOfLeafList;
}
@@ -212,9 +217,9 @@
* @param leafList the leaf-list to be added.
*/
@Override
- public void addLeafList(YangLeafList<?> leafList) {
+ public void addLeafList(YangLeafList leafList) {
if (getListOfLeafList() == null) {
- setListOfLeafList(new LinkedList<YangLeafList<?>>());
+ setListOfLeafList(new LinkedList<YangLeafList>());
}
getListOfLeafList().add(leafList);
@@ -290,44 +295,51 @@
// TODO auto-generated method stub, to be implemented by parser
}
- /* (non-Javadoc)
- * @see org.onosproject.yangutils.datamodel.YangNode#getName()
+ /**
+ * Get the target nodes name where the augmentation is being done.
+ *
+ * @return target nodes name where the augmentation is being done.
*/
@Override
public String getName() {
- // TODO Auto-generated method stub
- return null;
+ return targetNode;
}
- /* (non-Javadoc)
- * @see org.onosproject.yangutils.datamodel.YangNode#setName(java.lang.String)
+ /**
+ * Set the target nodes name where the augmentation is being done.
+ *
+ * @param name target nodes name where the augmentation is being done.
*/
@Override
public void setName(String name) {
- // TODO Auto-generated method stub
+ targetNode = name;
}
- /* (non-Javadoc)
- * @see org.onosproject.yangutils.datamodel.YangNode#getPackage()
+ /**
+ * Get the mapped java package.
+ *
+ * @return the java package
*/
@Override
public String getPackage() {
- // TODO Auto-generated method stub
- return null;
+ return pkg;
}
- /* (non-Javadoc)
- * @see org.onosproject.yangutils.datamodel.YangNode#setPackage(java.lang.String)
+ /**
+ * Set the mapped java package.
+ *
+ * @param pakg the package to set
*/
@Override
- public void setPackage(String pkg) {
- // TODO Auto-generated method stub
+ public void setPackage(String pakg) {
+ pkg = pakg;
}
- /* (non-Javadoc)
- * @see org.onosproject.yangutils.translator.CodeGenerator#generateJavaCodeEntry()
+ /**
+ * Prepare the information for java code generation corresponding to YANG
+ * grouping info.
*/
@Override
public void generateJavaCodeEntry() {
@@ -335,8 +347,8 @@
}
- /* (non-Javadoc)
- * @see org.onosproject.yangutils.translator.CodeGenerator#generateJavaCodeExit()
+ /**
+ * Create a java file using the YANG grouping info.
*/
@Override
public void generateJavaCodeExit() {
diff --git a/utils/yangutils/src/main/java/org/onosproject/yangutils/datamodel/YangBelongsTo.java b/utils/yangutils/src/main/java/org/onosproject/yangutils/datamodel/YangBelongsTo.java
index 0dbc7eda..a4a5cae 100644
--- a/utils/yangutils/src/main/java/org/onosproject/yangutils/datamodel/YangBelongsTo.java
+++ b/utils/yangutils/src/main/java/org/onosproject/yangutils/datamodel/YangBelongsTo.java
@@ -114,6 +114,7 @@
*
* @return ParsedDataType returns BELONGS_TO_DATA
*/
+ @Override
public ParsableDataType getParsableDataType() {
return ParsableDataType.BELONGS_TO_DATA;
}
@@ -123,6 +124,7 @@
*
* @throws DataModelException a violation of data model rules.
*/
+ @Override
public void validateDataOnEntry() throws DataModelException {
// TODO auto-generated method stub, to be implemented by parser
}
@@ -132,6 +134,7 @@
*
* @throws DataModelException a violation of data model rules.
*/
+ @Override
public void validateDataOnExit() throws DataModelException {
// TODO auto-generated method stub, to be implemented by parser
}
diff --git a/utils/yangutils/src/main/java/org/onosproject/yangutils/datamodel/YangBit.java b/utils/yangutils/src/main/java/org/onosproject/yangutils/datamodel/YangBit.java
index 722f239..5e33e36 100644
--- a/utils/yangutils/src/main/java/org/onosproject/yangutils/datamodel/YangBit.java
+++ b/utils/yangutils/src/main/java/org/onosproject/yangutils/datamodel/YangBit.java
@@ -101,6 +101,7 @@
*
* @return the description.
*/
+ @Override
public String getDescription() {
return description;
}
@@ -110,6 +111,7 @@
*
* @param description set the description.
*/
+ @Override
public void setDescription(String description) {
this.description = description;
}
@@ -119,6 +121,7 @@
*
* @return the reference.
*/
+ @Override
public String getReference() {
return reference;
}
@@ -128,6 +131,7 @@
*
* @param reference the reference to set.
*/
+ @Override
public void setReference(String reference) {
this.reference = reference;
}
@@ -137,6 +141,7 @@
*
* @return the status.
*/
+ @Override
public YangStatusType getStatus() {
return status;
}
@@ -146,6 +151,7 @@
*
* @param status the status to set.
*/
+ @Override
public void setStatus(YangStatusType status) {
this.status = status;
}
@@ -173,6 +179,7 @@
*
* @return ParsedDataType returns BIT_DATA
*/
+ @Override
public ParsableDataType getParsableDataType() {
return ParsableDataType.BIT_DATA;
}
@@ -182,6 +189,7 @@
*
* @throws DataModelException a violation of data model rules.
*/
+ @Override
public void validateDataOnEntry() throws DataModelException {
// TODO auto-generated method stub, to be implemented by parser
}
@@ -191,6 +199,7 @@
*
* @throws DataModelException a violation of data model rules.
*/
+ @Override
public void validateDataOnExit() throws DataModelException {
// TODO auto-generated method stub, to be implemented by parser
}
diff --git a/utils/yangutils/src/main/java/org/onosproject/yangutils/datamodel/YangBits.java b/utils/yangutils/src/main/java/org/onosproject/yangutils/datamodel/YangBits.java
index d158e4c..d519925 100644
--- a/utils/yangutils/src/main/java/org/onosproject/yangutils/datamodel/YangBits.java
+++ b/utils/yangutils/src/main/java/org/onosproject/yangutils/datamodel/YangBits.java
@@ -77,6 +77,7 @@
*
* @return ParsedDataType returns BITS_DATA
*/
+ @Override
public ParsableDataType getParsableDataType() {
return ParsableDataType.BITS_DATA;
}
@@ -86,6 +87,7 @@
*
* @throws DataModelException a violation of data model rules.
*/
+ @Override
public void validateDataOnEntry() throws DataModelException {
// TODO auto-generated method stub, to be implemented by parser
}
@@ -95,6 +97,7 @@
*
* @throws DataModelException a violation of data model rules.
*/
+ @Override
public void validateDataOnExit() throws DataModelException {
// TODO auto-generated method stub, to be implemented by parser
}
diff --git a/utils/yangutils/src/main/java/org/onosproject/yangutils/datamodel/YangCase.java b/utils/yangutils/src/main/java/org/onosproject/yangutils/datamodel/YangCase.java
index bcfa70c..dc9f36b 100644
--- a/utils/yangutils/src/main/java/org/onosproject/yangutils/datamodel/YangCase.java
+++ b/utils/yangutils/src/main/java/org/onosproject/yangutils/datamodel/YangCase.java
@@ -89,7 +89,8 @@
/**
* Data model node to maintain information defined in YANG case.
*/
-public class YangCase extends YangNode implements YangLeavesHolder, YangCommonInfo, Parsable {
+public class YangCase extends YangNode
+ implements YangLeavesHolder, YangCommonInfo, Parsable {
/**
* Case name.
@@ -106,12 +107,12 @@
/**
* List of leaves.
*/
- private List<YangLeaf<?>> listOfLeaf;
+ private List<YangLeaf> listOfLeaf;
/**
* List of leaf lists.
*/
- private List<YangLeafList<?>> listOfLeafList;
+ private List<YangLeafList> listOfLeafList;
/**
* Reference of the module.
@@ -124,22 +125,31 @@
private YangStatusType status;
/**
+ * package of the generated java code.
+ */
+ private String pkg;
+
+ /**
* Create a choice node.
*/
public YangCase() {
super(YangNodeType.CASE_NODE);
}
- /* (non-Javadoc)
- * @see org.onosproject.yangutils.datamodel.YangNode#getName()
+ /**
+ * Get the case name.
+ *
+ * @return case name.
*/
@Override
public String getName() {
return name;
}
- /* (non-Javadoc)
- * @see org.onosproject.yangutils.datamodel.YangNode#setName(java.lang.String)
+ /**
+ * Set the case name.
+ *
+ * @param name case name.
*/
@Override
public void setName(String name) {
@@ -172,7 +182,7 @@
* @return the list of leaves.
*/
@Override
- public List<YangLeaf<?>> getListOfLeaf() {
+ public List<YangLeaf> getListOfLeaf() {
return listOfLeaf;
}
@@ -181,7 +191,7 @@
*
* @param leafsList the list of leaf to set.
*/
- private void setListOfLeaf(List<YangLeaf<?>> leafsList) {
+ private void setListOfLeaf(List<YangLeaf> leafsList) {
listOfLeaf = leafsList;
}
@@ -191,9 +201,9 @@
* @param leaf the leaf to be added.
*/
@Override
- public void addLeaf(YangLeaf<?> leaf) {
+ public void addLeaf(YangLeaf leaf) {
if (getListOfLeaf() == null) {
- setListOfLeaf(new LinkedList<YangLeaf<?>>());
+ setListOfLeaf(new LinkedList<YangLeaf>());
}
getListOfLeaf().add(leaf);
@@ -205,7 +215,7 @@
* @return the list of leaf-list.
*/
@Override
- public List<YangLeafList<?>> getListOfLeafList() {
+ public List<YangLeafList> getListOfLeafList() {
return listOfLeafList;
}
@@ -214,7 +224,7 @@
*
* @param listOfLeafList the list of leaf-list to set.
*/
- private void setListOfLeafList(List<YangLeafList<?>> listOfLeafList) {
+ private void setListOfLeafList(List<YangLeafList> listOfLeafList) {
this.listOfLeafList = listOfLeafList;
}
@@ -224,9 +234,9 @@
* @param leafList the leaf-list to be added.
*/
@Override
- public void addLeafList(YangLeafList<?> leafList) {
+ public void addLeafList(YangLeafList leafList) {
if (getListOfLeafList() == null) {
- setListOfLeafList(new LinkedList<YangLeafList<?>>());
+ setListOfLeafList(new LinkedList<YangLeafList>());
}
getListOfLeafList().add(leafList);
@@ -302,26 +312,29 @@
// TODO auto-generated method stub, to be implemented by parser
}
- /* (non-Javadoc)
- * @see org.onosproject.yangutils.datamodel.YangNode#getPackage()
+ /**
+ * Get the mapped java package.
+ *
+ * @return the java package
*/
@Override
public String getPackage() {
- // TODO Auto-generated method stub
- return null;
+ return pkg;
}
- /* (non-Javadoc)
- * @see org.onosproject.yangutils.datamodel.YangNode#setPackage(java.lang.String)
+ /**
+ * Set the mapped java package.
+ *
+ * @param pakg the package to set
*/
@Override
- public void setPackage(String pkg) {
- // TODO Auto-generated method stub
+ public void setPackage(String pakg) {
+ pkg = pakg;
}
- /* (non-Javadoc)
- * @see org.onosproject.yangutils.translator.CodeGenerator#generateJavaCodeEntry()
+ /**
+ * Generate the code corresponding to YANG case info.
*/
@Override
public void generateJavaCodeEntry() {
@@ -329,8 +342,9 @@
}
- /* (non-Javadoc)
- * @see org.onosproject.yangutils.translator.CodeGenerator#generateJavaCodeExit()
+ /**
+ * Free resource used for generating code and generate valid java files
+ * corresponding to YANG case info.
*/
@Override
public void generateJavaCodeExit() {
diff --git a/utils/yangutils/src/main/java/org/onosproject/yangutils/datamodel/YangContainer.java b/utils/yangutils/src/main/java/org/onosproject/yangutils/datamodel/YangContainer.java
index 62a589a..7957a1a 100644
--- a/utils/yangutils/src/main/java/org/onosproject/yangutils/datamodel/YangContainer.java
+++ b/utils/yangutils/src/main/java/org/onosproject/yangutils/datamodel/YangContainer.java
@@ -109,12 +109,12 @@
/**
* List of leaves contained.
*/
- private List<YangLeaf<?>> listOfLeaf;
+ private List<YangLeaf> listOfLeaf;
/**
* List of leaf-lists contained.
*/
- private List<YangLeafList<?>> listOfLeafList;
+ private List<YangLeafList> listOfLeafList;
/**
* If it is a presence container, then the textual documentation of presence
@@ -130,7 +130,7 @@
/**
* Status of the node.
*/
- private YangStatusType status;
+ private YangStatusType status = YangStatusType.CURRENT;
/**
* Package of the generated java code.
@@ -149,16 +149,20 @@
super(YangNodeType.CONTAINER_NODE);
}
- /* (non-Javadoc)
- * @see org.onosproject.yangutils.datamodel.YangNode#getName()
+ /**
+ * Get the YANG name of container.
+ *
+ * @return the name of container as defined in YANG file.
*/
@Override
public String getName() {
return name;
}
- /* (non-Javadoc)
- * @see org.onosproject.yangutils.datamodel.YangNode#setName(java.lang.String)
+ /**
+ * Set the YANG name of container.
+ *
+ * @param name the name of container as defined in YANG file.
*/
@Override
public void setName(String name) {
@@ -209,7 +213,7 @@
* @return the list of leaves.
*/
@Override
- public List<YangLeaf<?>> getListOfLeaf() {
+ public List<YangLeaf> getListOfLeaf() {
return listOfLeaf;
}
@@ -218,7 +222,7 @@
*
* @param leafsList the list of leaf to set.
*/
- private void setListOfLeaf(List<YangLeaf<?>> leafsList) {
+ private void setListOfLeaf(List<YangLeaf> leafsList) {
listOfLeaf = leafsList;
}
@@ -228,9 +232,9 @@
* @param leaf the leaf to be added.
*/
@Override
- public void addLeaf(YangLeaf<?> leaf) {
+ public void addLeaf(YangLeaf leaf) {
if (getListOfLeaf() == null) {
- setListOfLeaf(new LinkedList<YangLeaf<?>>());
+ setListOfLeaf(new LinkedList<YangLeaf>());
}
getListOfLeaf().add(leaf);
@@ -242,7 +246,7 @@
* @return the list of leaf-list.
*/
@Override
- public List<YangLeafList<?>> getListOfLeafList() {
+ public List<YangLeafList> getListOfLeafList() {
return listOfLeafList;
}
@@ -251,7 +255,7 @@
*
* @param listOfLeafList the list of leaf-list to set.
*/
- private void setListOfLeafList(List<YangLeafList<?>> listOfLeafList) {
+ private void setListOfLeafList(List<YangLeafList> listOfLeafList) {
this.listOfLeafList = listOfLeafList;
}
@@ -261,9 +265,9 @@
* @param leafList the leaf-list to be added.
*/
@Override
- public void addLeafList(YangLeafList<?> leafList) {
+ public void addLeafList(YangLeafList leafList) {
if (getListOfLeafList() == null) {
- setListOfLeafList(new LinkedList<YangLeafList<?>>());
+ setListOfLeafList(new LinkedList<YangLeafList>());
}
getListOfLeafList().add(leafList);
@@ -397,6 +401,11 @@
pkg = pcg;
}
+ /**
+ * Generate the java code corresponding to YANG container.
+ *
+ * @throws IOException when fails to generate the source files.
+ */
@Override
public void generateJavaCodeEntry() throws IOException {
YangNode parent = getParent();
@@ -416,8 +425,6 @@
/**
* Adds current node attribute to parent file.
- *
- * @param pkg java file package path
*/
private void addAttributeInParent() {
if (getParent() != null) {
@@ -439,9 +446,9 @@
*/
private void addLeavesAttributes() {
- List<YangLeaf<?>> leaves = getListOfLeaf();
+ List<YangLeaf> leaves = getListOfLeaf();
if (leaves != null) {
- for (YangLeaf<?> leaf : leaves) {
+ for (YangLeaf leaf : leaves) {
getFileHandle().addAttributeInfo(leaf.getDataType(), leaf.getLeafName(), false);
}
}
@@ -451,9 +458,9 @@
* Adds leaf list's attributes in generated files.
*/
private void addLeafListAttributes() {
- List<YangLeafList<?>> leavesList = getListOfLeafList();
+ List<YangLeafList> leavesList = getListOfLeafList();
if (leavesList != null) {
- for (YangLeafList<?> leafList : leavesList) {
+ for (YangLeafList leafList : leavesList) {
getFileHandle().addAttributeInfo(leafList.getDataType(), leafList.getLeafName(), true);
}
}
diff --git a/utils/yangutils/src/main/java/org/onosproject/yangutils/datamodel/YangEnum.java b/utils/yangutils/src/main/java/org/onosproject/yangutils/datamodel/YangEnum.java
index be3f845..59da354 100644
--- a/utils/yangutils/src/main/java/org/onosproject/yangutils/datamodel/YangEnum.java
+++ b/utils/yangutils/src/main/java/org/onosproject/yangutils/datamodel/YangEnum.java
@@ -105,6 +105,7 @@
*
* @return the description.
*/
+ @Override
public String getDescription() {
return description;
}
@@ -114,6 +115,7 @@
*
* @param description set the description.
*/
+ @Override
public void setDescription(String description) {
this.description = description;
}
@@ -123,6 +125,7 @@
*
* @return the reference.
*/
+ @Override
public String getReference() {
return reference;
}
@@ -132,6 +135,7 @@
*
* @param reference the reference to set.
*/
+ @Override
public void setReference(String reference) {
this.reference = reference;
}
@@ -141,6 +145,7 @@
*
* @return the status.
*/
+ @Override
public YangStatusType getStatus() {
return status;
}
@@ -150,6 +155,7 @@
*
* @param status the status to set.
*/
+ @Override
public void setStatus(YangStatusType status) {
this.status = status;
}
@@ -177,6 +183,7 @@
*
* @return ParsedDataType returns ENUM_DATA
*/
+ @Override
public ParsableDataType getParsableDataType() {
return ParsableDataType.ENUM_DATA;
}
@@ -186,6 +193,7 @@
*
* @throws DataModelException a violation of data model rules.
*/
+ @Override
public void validateDataOnEntry() throws DataModelException {
// TODO auto-generated method stub, to be implemented by parser
}
@@ -195,6 +203,7 @@
*
* @throws DataModelException a violation of data model rules.
*/
+ @Override
public void validateDataOnExit() throws DataModelException {
// TODO auto-generated method stub, to be implemented by parser
}
diff --git a/utils/yangutils/src/main/java/org/onosproject/yangutils/datamodel/YangGrouping.java b/utils/yangutils/src/main/java/org/onosproject/yangutils/datamodel/YangGrouping.java
index 8dc0123..4e3061d 100644
--- a/utils/yangutils/src/main/java/org/onosproject/yangutils/datamodel/YangGrouping.java
+++ b/utils/yangutils/src/main/java/org/onosproject/yangutils/datamodel/YangGrouping.java
@@ -76,7 +76,8 @@
/**
* Data model node to maintain information defined in YANG grouping.
*/
-public class YangGrouping extends YangNode implements YangLeavesHolder, YangCommonInfo, Parsable {
+public class YangGrouping extends YangNode
+ implements YangLeavesHolder, YangCommonInfo, Parsable {
/**
* Name of the grouping.
@@ -91,12 +92,12 @@
/**
* List of leaves.
*/
- private List<YangLeaf<?>> listOfLeaf;
+ private List<YangLeaf> listOfLeaf;
/**
* List of leaf lists.
*/
- private List<YangLeafList<?>> listOfLeafList;
+ private List<YangLeafList> listOfLeafList;
/**
* Reference of the module.
@@ -109,22 +110,31 @@
private YangStatusType status;
/**
+ * package of the generated java code.
+ */
+ private String pkg;
+
+ /**
* Creates the grouping node.
*/
public YangGrouping() {
super(YangNodeType.GROUPING_NODE);
}
- /* (non-Javadoc)
- * @see org.onosproject.yangutils.datamodel.YangNode#getName()
+ /**
+ * Get YANG grouping name.
+ *
+ * @return YANG grouping name.
*/
@Override
public String getName() {
return name;
}
- /* (non-Javadoc)
- * @see org.onosproject.yangutils.datamodel.YangNode#setName(java.lang.String)
+ /**
+ * Set YANG grouping name.
+ *
+ * @param name YANG grouping name.
*/
@Override
public void setName(String name) {
@@ -157,7 +167,7 @@
* @return the list of leaves.
*/
@Override
- public List<YangLeaf<?>> getListOfLeaf() {
+ public List<YangLeaf> getListOfLeaf() {
return listOfLeaf;
}
@@ -166,7 +176,7 @@
*
* @param leafsList the list of leaf to set.
*/
- private void setListOfLeaf(List<YangLeaf<?>> leafsList) {
+ private void setListOfLeaf(List<YangLeaf> leafsList) {
listOfLeaf = leafsList;
}
@@ -176,9 +186,9 @@
* @param leaf the leaf to be added.
*/
@Override
- public void addLeaf(YangLeaf<?> leaf) {
+ public void addLeaf(YangLeaf leaf) {
if (getListOfLeaf() == null) {
- setListOfLeaf(new LinkedList<YangLeaf<?>>());
+ setListOfLeaf(new LinkedList<YangLeaf>());
}
getListOfLeaf().add(leaf);
@@ -190,7 +200,7 @@
* @return the list of leaf-list.
*/
@Override
- public List<YangLeafList<?>> getListOfLeafList() {
+ public List<YangLeafList> getListOfLeafList() {
return listOfLeafList;
}
@@ -199,7 +209,7 @@
*
* @param listOfLeafList the list of leaf-list to set.
*/
- private void setListOfLeafList(List<YangLeafList<?>> listOfLeafList) {
+ private void setListOfLeafList(List<YangLeafList> listOfLeafList) {
this.listOfLeafList = listOfLeafList;
}
@@ -209,9 +219,9 @@
* @param leafList the leaf-list to be added.
*/
@Override
- public void addLeafList(YangLeafList<?> leafList) {
+ public void addLeafList(YangLeafList leafList) {
if (getListOfLeafList() == null) {
- setListOfLeafList(new LinkedList<YangLeafList<?>>());
+ setListOfLeafList(new LinkedList<YangLeafList>());
}
getListOfLeafList().add(leafList);
@@ -287,8 +297,8 @@
// TODO auto-generated method stub, to be implemented by parser
}
- /* (non-Javadoc)
- * @see org.onosproject.yangutils.translator.CodeGenerator#generateJavaCodeEntry()
+ /**
+ * Generate the code for YANG grouping.
*/
@Override
public void generateJavaCodeEntry() {
@@ -296,8 +306,9 @@
}
- /* (non-Javadoc)
- * @see org.onosproject.yangutils.translator.CodeGenerator#generateJavaCodeExit()
+ /**
+ * Free the resources used to generate java files corresponding to YANG
+ * grouping info and generate valid java files.
*/
@Override
public void generateJavaCodeExit() {
@@ -305,21 +316,24 @@
}
- /* (non-Javadoc)
- * @see org.onosproject.yangutils.datamodel.YangNode#getPackage()
+ /**
+ * Get the mapped java package.
+ *
+ * @return the java package
*/
@Override
public String getPackage() {
- // TODO Auto-generated method stub
- return null;
+ return pkg;
}
- /* (non-Javadoc)
- * @see org.onosproject.yangutils.datamodel.YangNode#setPackage(java.lang.String)
+ /**
+ * Set the mapped java package.
+ *
+ * @param pakg the package to set
*/
@Override
- public void setPackage(String pkg) {
- // TODO Auto-generated method stub
+ public void setPackage(String pakg) {
+ pkg = pakg;
}
diff --git a/utils/yangutils/src/main/java/org/onosproject/yangutils/datamodel/YangImport.java b/utils/yangutils/src/main/java/org/onosproject/yangutils/datamodel/YangImport.java
index cf18a62..83f978e 100644
--- a/utils/yangutils/src/main/java/org/onosproject/yangutils/datamodel/YangImport.java
+++ b/utils/yangutils/src/main/java/org/onosproject/yangutils/datamodel/YangImport.java
@@ -76,6 +76,7 @@
/**
* Reference:RFC 6020.
+ *
* The import's "revision-date" statement is used to specify the exact
* version of the module to import. The "revision-date" statement MUST match
* the most recent "revision" statement in the imported module. organization
@@ -150,6 +151,7 @@
*
* @return returns IMPORT_DATA
*/
+ @Override
public ParsableDataType getParsableDataType() {
return ParsableDataType.IMPORT_DATA;
}
@@ -159,6 +161,7 @@
*
* @throws DataModelException a violation of data model rules
*/
+ @Override
public void validateDataOnEntry() throws DataModelException {
// TODO auto-generated method stub, to be implemented by parser
@@ -169,6 +172,7 @@
*
* @throws DataModelException a violation of data model rules
*/
+ @Override
public void validateDataOnExit() throws DataModelException {
// TODO auto-generated method stub, to be implemented by parser
diff --git a/utils/yangutils/src/main/java/org/onosproject/yangutils/datamodel/YangInclude.java b/utils/yangutils/src/main/java/org/onosproject/yangutils/datamodel/YangInclude.java
index de7355c..a506847 100644
--- a/utils/yangutils/src/main/java/org/onosproject/yangutils/datamodel/YangInclude.java
+++ b/utils/yangutils/src/main/java/org/onosproject/yangutils/datamodel/YangInclude.java
@@ -97,6 +97,7 @@
*
* @return returns INCLUDE_DATA
*/
+ @Override
public ParsableDataType getParsableDataType() {
return ParsableDataType.INCLUDE_DATA;
}
@@ -106,6 +107,7 @@
*
* @throws DataModelException a violation of data model rules
*/
+ @Override
public void validateDataOnEntry() throws DataModelException {
// TODO auto-generated method stub, to be implemented by parser
@@ -116,6 +118,7 @@
*
* @throws DataModelException a violation of data model rules
*/
+ @Override
public void validateDataOnExit() throws DataModelException {
// TODO auto-generated method stub, to be implemented by parser
diff --git a/utils/yangutils/src/main/java/org/onosproject/yangutils/datamodel/YangLeaf.java b/utils/yangutils/src/main/java/org/onosproject/yangutils/datamodel/YangLeaf.java
index d2837da..764f498 100644
--- a/utils/yangutils/src/main/java/org/onosproject/yangutils/datamodel/YangLeaf.java
+++ b/utils/yangutils/src/main/java/org/onosproject/yangutils/datamodel/YangLeaf.java
@@ -56,9 +56,8 @@
/**
* Leaf data represented in YANG.
*
- * @param <T> YANG data type
*/
-public class YangLeaf<T> implements YangCommonInfo, Parsable {
+public class YangLeaf implements YangCommonInfo, Parsable {
/**
* Name of leaf.
@@ -88,7 +87,7 @@
/**
* Status of leaf in YANG definition.
*/
- private YangStatusType status;
+ private YangStatusType status = YangStatusType.CURRENT;
/**
* Textual units info.
@@ -98,7 +97,7 @@
/**
* Data type of the leaf.
*/
- private YangType<T> dataType;
+ private YangType<?> dataType;
/**
* Default constructor to create a YANG leaf.
@@ -121,7 +120,7 @@
* @param leafName the leaf name to set.
*/
public void setLeafName(String leafName) {
- this.name = leafName;
+ name = leafName;
}
/**
@@ -147,6 +146,7 @@
*
* @return the description.
*/
+ @Override
public String getDescription() {
return description;
}
@@ -156,6 +156,7 @@
*
* @param description set the description.
*/
+ @Override
public void setDescription(String description) {
this.description = description;
}
@@ -183,6 +184,7 @@
*
* @return the reference.
*/
+ @Override
public String getReference() {
return reference;
}
@@ -192,6 +194,7 @@
*
* @param reference the reference to set.
*/
+ @Override
public void setReference(String reference) {
this.reference = reference;
}
@@ -201,6 +204,7 @@
*
* @return the status.
*/
+ @Override
public YangStatusType getStatus() {
return status;
}
@@ -210,6 +214,7 @@
*
* @param status the status to set.
*/
+ @Override
public void setStatus(YangStatusType status) {
this.status = status;
}
@@ -237,7 +242,7 @@
*
* @return the data type.
*/
- public YangType<T> getDataType() {
+ public YangType<?> getDataType() {
return dataType;
}
@@ -246,7 +251,7 @@
*
* @param dataType the data type to set.
*/
- public void setDataType(YangType<T> dataType) {
+ public void setDataType(YangType<?> dataType) {
this.dataType = dataType;
}
@@ -255,6 +260,7 @@
*
* @return returns LEAF_DATA.
*/
+ @Override
public ParsableDataType getParsableDataType() {
return ParsableDataType.LEAF_DATA;
}
@@ -264,6 +270,7 @@
*
* @throws DataModelException a violation of data model rules.
*/
+ @Override
public void validateDataOnEntry() throws DataModelException {
// TODO auto-generated method stub, to be implemented by parser
@@ -274,6 +281,7 @@
*
* @throws DataModelException a violation of data model rules.
*/
+ @Override
public void validateDataOnExit() throws DataModelException {
// TODO auto-generated method stub, to be implemented by parser
diff --git a/utils/yangutils/src/main/java/org/onosproject/yangutils/datamodel/YangLeafList.java b/utils/yangutils/src/main/java/org/onosproject/yangutils/datamodel/YangLeafList.java
index d005458..18653d2 100644
--- a/utils/yangutils/src/main/java/org/onosproject/yangutils/datamodel/YangLeafList.java
+++ b/utils/yangutils/src/main/java/org/onosproject/yangutils/datamodel/YangLeafList.java
@@ -51,10 +51,8 @@
*/
/**
* Leaf-list data represented in YANG.
- *
- * @param <T> YANG data type
*/
-public class YangLeafList<T> implements YangCommonInfo, Parsable {
+public class YangLeafList implements YangCommonInfo, Parsable {
/**
* Name of leaf-list.
@@ -73,6 +71,7 @@
/**
* Reference:RFC 6020.
+ *
* The "max-elements" statement, which is optional, takes as an argument a
* positive integer or the string "unbounded", which puts a constraint on
* valid list entries. A valid leaf-list or list always has at most
@@ -80,10 +79,11 @@
*
* If no "max-elements" statement is present, it defaults to "unbounded".
*/
- private int maxElelements;
+ private int maxElelements = Integer.MAX_VALUE;
/**
* Reference:RFC 6020.
+ *
* The "min-elements" statement, which is optional, takes as an argument a
* non-negative integer that puts a constraint on valid list entries. A
* valid leaf-list or list MUST have at least min-elements entries.
@@ -99,7 +99,7 @@
*
* o Otherwise, it is enforced if the ancestor node exists.
*/
- private int minElements;
+ private int minElements = 0;
/**
* The textual reference to this leaf-list.
@@ -109,7 +109,7 @@
/**
* Status of the leaf-list in the YANG definition.
*/
- private YangStatusType status;
+ private YangStatusType status = YangStatusType.CURRENT;
/**
* Textual units.
@@ -119,7 +119,7 @@
/**
* Data type of leaf-list.
*/
- private YangType<T> dataType;
+ private YangType<?> dataType;
/**
* Default Constructor to create a YANG leaf-list.
@@ -142,7 +142,7 @@
* @param leafListName the leaf-list name to set.
*/
public void setLeafName(String leafListName) {
- this.name = leafListName;
+ name = leafListName;
}
/**
@@ -168,6 +168,7 @@
*
* @return the description.
*/
+ @Override
public String getDescription() {
return description;
}
@@ -177,6 +178,7 @@
*
* @param description set the description.
*/
+ @Override
public void setDescription(String description) {
this.description = description;
}
@@ -222,6 +224,7 @@
*
* @return the reference.
*/
+ @Override
public String getReference() {
return reference;
}
@@ -231,6 +234,7 @@
*
* @param reference the reference to set.
*/
+ @Override
public void setReference(String reference) {
this.reference = reference;
}
@@ -240,6 +244,7 @@
*
* @return the status.
*/
+ @Override
public YangStatusType getStatus() {
return status;
}
@@ -249,6 +254,7 @@
*
* @param status the status to set.
*/
+ @Override
public void setStatus(YangStatusType status) {
this.status = status;
}
@@ -276,7 +282,7 @@
*
* @return the data type.
*/
- public YangType<T> getDataType() {
+ public YangType<?> getDataType() {
return dataType;
}
@@ -285,7 +291,7 @@
*
* @param dataType the data type to set.
*/
- public void setDataType(YangType<T> dataType) {
+ public void setDataType(YangType<?> dataType) {
this.dataType = dataType;
}
@@ -294,6 +300,7 @@
*
* @return returns LEAF_LIST_DATA.
*/
+ @Override
public ParsableDataType getParsableDataType() {
return ParsableDataType.LEAF_LIST_DATA;
}
@@ -303,6 +310,7 @@
*
* @throws DataModelException a violation of data model rules.
*/
+ @Override
public void validateDataOnEntry() throws DataModelException {
// TODO auto-generated method stub, to be implemented by parser
@@ -313,6 +321,7 @@
*
* @throws DataModelException a violation of data model rules.
*/
+ @Override
public void validateDataOnExit() throws DataModelException {
// TODO auto-generated method stub, to be implemented by parser
diff --git a/utils/yangutils/src/main/java/org/onosproject/yangutils/datamodel/YangLeavesHolder.java b/utils/yangutils/src/main/java/org/onosproject/yangutils/datamodel/YangLeavesHolder.java
index ba42bfc..f8fc6b6 100644
--- a/utils/yangutils/src/main/java/org/onosproject/yangutils/datamodel/YangLeavesHolder.java
+++ b/utils/yangutils/src/main/java/org/onosproject/yangutils/datamodel/YangLeavesHolder.java
@@ -27,26 +27,26 @@
*
* @return the list of leaves.
*/
- public List<YangLeaf<?>> getListOfLeaf();
+ public List<YangLeaf> getListOfLeaf();
/**
* Add a leaf in data holder like container / list.
*
* @param leaf the leaf to be added.
*/
- void addLeaf(YangLeaf<?> leaf);
+ void addLeaf(YangLeaf leaf);
/**
* Get the list of leaf-list from data holder like container / list.
*
* @return the list of leaf-list.
*/
- List<YangLeafList<?>> getListOfLeafList();
+ List<YangLeafList> getListOfLeafList();
/**
* Add a leaf-list in data holder like container / list.
*
* @param leafList the leaf-list to be added.
*/
- void addLeafList(YangLeafList<?> leafList);
+ void addLeafList(YangLeafList leafList);
}
diff --git a/utils/yangutils/src/main/java/org/onosproject/yangutils/datamodel/YangList.java b/utils/yangutils/src/main/java/org/onosproject/yangutils/datamodel/YangList.java
index 577e160..8a328e0 100644
--- a/utils/yangutils/src/main/java/org/onosproject/yangutils/datamodel/YangList.java
+++ b/utils/yangutils/src/main/java/org/onosproject/yangutils/datamodel/YangList.java
@@ -66,7 +66,8 @@
/**
* List data represented in YANG.
*/
-public class YangList extends YangNode implements YangLeavesHolder, YangCommonInfo, Parsable {
+public class YangList extends YangNode
+ implements YangLeavesHolder, YangCommonInfo, Parsable {
/**
* name of the YANG list.
@@ -113,12 +114,12 @@
/**
* List of leaves.
*/
- private List<YangLeaf<?>> listOfLeaf;
+ private List<YangLeaf> listOfLeaf;
/**
* List of leaf-lists.
*/
- private List<YangLeafList<?>> listOfLeafList;
+ private List<YangLeafList> listOfLeafList;
/**
* The "max-elements" statement, which is optional, takes as an argument a
@@ -128,7 +129,7 @@
*
* If no "max-elements" statement is present, it defaults to "unbounded".
*/
- private int maxElelements;
+ private int maxElelements = Integer.MAX_VALUE;
/**
* The "min-elements" statement, which is optional, takes as an argument a
@@ -146,7 +147,7 @@
*
* o Otherwise, it is enforced if the ancestor node exists.
*/
- private int minElements;
+ private int minElements = 0;
/**
* reference.
@@ -157,7 +158,12 @@
* Status of the node.
*/
- private YangStatusType status;
+ private YangStatusType status = YangStatusType.CURRENT;
+
+ /**
+ * package of the generated java code.
+ */
+ private String pkg;
/**
* Constructor.
@@ -168,16 +174,20 @@
super(type);
}
- /* (non-Javadoc)
- * @see org.onosproject.yangutils.datamodel.YangNode#getName()
+ /**
+ * Get the YANG list name.
+ *
+ * @return YANG list name.
*/
@Override
public String getName() {
return name;
}
- /* (non-Javadoc)
- * @see org.onosproject.yangutils.datamodel.YangNode#setName(java.lang.String)
+ /**
+ * Set the YANG list name.
+ *
+ * @param name YANG list name.
*/
@Override
public void setName(String name) {
@@ -249,7 +259,6 @@
if (getKeyList() == null) {
setKeyList(new LinkedList<String>());
}
-
getKeyList().add(key);
}
@@ -259,7 +268,7 @@
* @return the list of leaves.
*/
@Override
- public List<YangLeaf<?>> getListOfLeaf() {
+ public List<YangLeaf> getListOfLeaf() {
return listOfLeaf;
}
@@ -268,7 +277,7 @@
*
* @param leafsList the list of leaf to set.
*/
- private void setListOfLeaf(List<YangLeaf<?>> leafsList) {
+ private void setListOfLeaf(List<YangLeaf> leafsList) {
listOfLeaf = leafsList;
}
@@ -278,9 +287,9 @@
* @param leaf the leaf to be added.
*/
@Override
- public void addLeaf(YangLeaf<?> leaf) {
+ public void addLeaf(YangLeaf leaf) {
if (getListOfLeaf() == null) {
- setListOfLeaf(new LinkedList<YangLeaf<?>>());
+ setListOfLeaf(new LinkedList<YangLeaf>());
}
getListOfLeaf().add(leaf);
@@ -292,7 +301,7 @@
* @return the list of leaf-list.
*/
@Override
- public List<YangLeafList<?>> getListOfLeafList() {
+ public List<YangLeafList> getListOfLeafList() {
return listOfLeafList;
}
@@ -301,7 +310,7 @@
*
* @param listOfLeafList the list of leaf-list to set.
*/
- private void setListOfLeafList(List<YangLeafList<?>> listOfLeafList) {
+ private void setListOfLeafList(List<YangLeafList> listOfLeafList) {
this.listOfLeafList = listOfLeafList;
}
@@ -311,9 +320,9 @@
* @param leafList the leaf-list to be added.
*/
@Override
- public void addLeafList(YangLeafList<?> leafList) {
+ public void addLeafList(YangLeafList leafList) {
if (getListOfLeafList() == null) {
- setListOfLeafList(new LinkedList<YangLeafList<?>>());
+ setListOfLeafList(new LinkedList<YangLeafList>());
}
getListOfLeafList().add(leafList);
@@ -434,8 +443,9 @@
}
- /* (non-Javadoc)
- * @see org.onosproject.yangutils.translator.CodeGenerator#generateJavaCodeExit()
+ /**
+ * Free the resources used to generate the java file corresponding to YANG
+ * list info.
*/
@Override
public void generateJavaCodeExit() {
@@ -443,21 +453,24 @@
}
- /* (non-Javadoc)
- * @see org.onosproject.yangutils.datamodel.YangNode#getPackage()
+ /**
+ * Get the mapped java package.
+ *
+ * @return the java package
*/
@Override
public String getPackage() {
- // TODO Auto-generated method stub
- return null;
+ return pkg;
}
- /* (non-Javadoc)
- * @see org.onosproject.yangutils.datamodel.YangNode#setPackage(java.lang.String)
+ /**
+ * Set the mapped java package.
+ *
+ * @param pakg the package to set
*/
@Override
- public void setPackage(String pkg) {
- // TODO Auto-generated method stub
+ public void setPackage(String pakg) {
+ pkg = pakg;
}
diff --git a/utils/yangutils/src/main/java/org/onosproject/yangutils/datamodel/YangModule.java b/utils/yangutils/src/main/java/org/onosproject/yangutils/datamodel/YangModule.java
index d1d3c7e..836ad77 100644
--- a/utils/yangutils/src/main/java/org/onosproject/yangutils/datamodel/YangModule.java
+++ b/utils/yangutils/src/main/java/org/onosproject/yangutils/datamodel/YangModule.java
@@ -71,7 +71,8 @@
/**
* Data model node to maintain information defined in YANG module.
*/
-public class YangModule extends YangNode implements YangLeavesHolder, YangDesc, YangReference, Parsable, CodeGenerator {
+public class YangModule extends YangNode
+ implements YangLeavesHolder, YangDesc, YangReference, Parsable, CodeGenerator {
/**
* Name of the module.
@@ -112,12 +113,12 @@
/**
* List of leaves at root level in the module.
*/
- private List<YangLeaf<?>> listOfLeaf;
+ private List<YangLeaf> listOfLeaf;
/**
* List of leaf-lists at root level in the module.
*/
- private List<YangLeafList<?>> listOfLeafList;
+ private List<YangLeafList> listOfLeafList;
/**
* Name space of the module.
@@ -298,7 +299,7 @@
* @return the list of leaves.
*/
@Override
- public List<YangLeaf<?>> getListOfLeaf() {
+ public List<YangLeaf> getListOfLeaf() {
return listOfLeaf;
}
@@ -307,7 +308,7 @@
*
* @param leafsList the list of leaf to set.
*/
- private void setListOfLeaf(List<YangLeaf<?>> leafsList) {
+ private void setListOfLeaf(List<YangLeaf> leafsList) {
listOfLeaf = leafsList;
}
@@ -317,9 +318,9 @@
* @param leaf the leaf to be added.
*/
@Override
- public void addLeaf(YangLeaf<?> leaf) {
+ public void addLeaf(YangLeaf leaf) {
if (getListOfLeaf() == null) {
- setListOfLeaf(new LinkedList<YangLeaf<?>>());
+ setListOfLeaf(new LinkedList<YangLeaf>());
}
getListOfLeaf().add(leaf);
@@ -331,7 +332,7 @@
* @return the list of leaf-list.
*/
@Override
- public List<YangLeafList<?>> getListOfLeafList() {
+ public List<YangLeafList> getListOfLeafList() {
return listOfLeafList;
}
@@ -340,7 +341,7 @@
*
* @param listOfLeafList the list of leaf-list to set.
*/
- private void setListOfLeafList(List<YangLeafList<?>> listOfLeafList) {
+ private void setListOfLeafList(List<YangLeafList> listOfLeafList) {
this.listOfLeafList = listOfLeafList;
}
@@ -350,9 +351,9 @@
* @param leafList the leaf-list to be added.
*/
@Override
- public void addLeafList(YangLeafList<?> leafList) {
+ public void addLeafList(YangLeafList leafList) {
if (getListOfLeafList() == null) {
- setListOfLeafList(new LinkedList<YangLeafList<?>>());
+ setListOfLeafList(new LinkedList<YangLeafList>());
}
getListOfLeafList().add(leafList);
@@ -525,7 +526,10 @@
*/
@Override
public void validateDataOnEntry() throws DataModelException {
- // TODO auto-generated method stub, to be implemented by parser
+ /*
+ * Module is root in the data model tree, hence there is no entry
+ * validation
+ */
}
/**
@@ -535,7 +539,10 @@
*/
@Override
public void validateDataOnExit() throws DataModelException {
- // TODO auto-generated method stub, to be implemented by parser
+ /*
+ * TODO: perform symbol linking for the imported or included YANG info.
+ * TODO: perform symbol resolution for referred YANG entities.
+ */
}
/**
@@ -572,9 +579,9 @@
*/
private void addLeavesAttributes() {
- List<YangLeaf<?>> leaves = getListOfLeaf();
+ List<YangLeaf> leaves = getListOfLeaf();
if (leaves != null) {
- for (YangLeaf<?> leaf : leaves) {
+ for (YangLeaf leaf : leaves) {
getFileHandle().addAttributeInfo(leaf.getDataType(), leaf.getLeafName(), false);
}
}
@@ -584,9 +591,9 @@
* Adds leaf list's attributes in generated files.
*/
private void addLeafListAttributes() {
- List<YangLeafList<?>> leavesList = getListOfLeafList();
+ List<YangLeafList> leavesList = getListOfLeafList();
if (leavesList != null) {
- for (YangLeafList<?> leafList : leavesList) {
+ for (YangLeafList leafList : leavesList) {
getFileHandle().addAttributeInfo(leafList.getDataType(), leafList.getLeafName(), true);
}
}
diff --git a/utils/yangutils/src/main/java/org/onosproject/yangutils/datamodel/YangMust.java b/utils/yangutils/src/main/java/org/onosproject/yangutils/datamodel/YangMust.java
index 92a1da3..63430c1 100644
--- a/utils/yangutils/src/main/java/org/onosproject/yangutils/datamodel/YangMust.java
+++ b/utils/yangutils/src/main/java/org/onosproject/yangutils/datamodel/YangMust.java
@@ -92,6 +92,7 @@
*
* @return the description.
*/
+ @Override
public String getDescription() {
return description;
}
@@ -101,6 +102,7 @@
*
* @param description set the description.
*/
+ @Override
public void setDescription(String description) {
this.description = description;
}
@@ -110,6 +112,7 @@
*
* @return the reference.
*/
+ @Override
public String getReference() {
return reference;
}
@@ -119,6 +122,7 @@
*
* @param reference the reference to set.
*/
+ @Override
public void setReference(String reference) {
this.reference = reference;
}
@@ -128,6 +132,7 @@
*
* @return returns MUST_DATA
*/
+ @Override
public ParsableDataType getParsableDataType() {
return ParsableDataType.MUST_DATA;
}
@@ -137,6 +142,7 @@
*
* @throws DataModelException a violation of data model rules.
*/
+ @Override
public void validateDataOnEntry() throws DataModelException {
// TODO auto-generated method stub, to be implemented by parser
}
@@ -146,6 +152,7 @@
*
* @throws DataModelException a violation of data model rules.
*/
+ @Override
public void validateDataOnExit() throws DataModelException {
// TODO auto-generated method stub, to be implemented by parser
}
diff --git a/utils/yangutils/src/main/java/org/onosproject/yangutils/datamodel/YangNameSpace.java b/utils/yangutils/src/main/java/org/onosproject/yangutils/datamodel/YangNameSpace.java
index 03779bd..2d79a6f 100644
--- a/utils/yangutils/src/main/java/org/onosproject/yangutils/datamodel/YangNameSpace.java
+++ b/utils/yangutils/src/main/java/org/onosproject/yangutils/datamodel/YangNameSpace.java
@@ -65,6 +65,7 @@
*
* @return returns NAMESPACE_DATA.
*/
+ @Override
public ParsableDataType getParsableDataType() {
return ParsableDataType.NAMESPACE_DATA;
}
@@ -74,6 +75,7 @@
*
* @throws DataModelException a violation of data model rules.
*/
+ @Override
public void validateDataOnEntry() throws DataModelException {
// TODO auto-generated method stub, to be implemented by parser
@@ -84,6 +86,7 @@
*
* @throws DataModelException a violation of data model rules.
*/
+ @Override
public void validateDataOnExit() throws DataModelException {
// TODO auto-generated method stub, to be implemented by parser
diff --git a/utils/yangutils/src/main/java/org/onosproject/yangutils/datamodel/YangPatternRestriction.java b/utils/yangutils/src/main/java/org/onosproject/yangutils/datamodel/YangPatternRestriction.java
new file mode 100644
index 0000000..dca527e
--- /dev/null
+++ b/utils/yangutils/src/main/java/org/onosproject/yangutils/datamodel/YangPatternRestriction.java
@@ -0,0 +1,102 @@
+/*Copyright 2016.year Open Networking Laboratory
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.*/
+package org.onosproject.yangutils.datamodel;
+
+import java.util.List;
+
+/*-
+ * Reference RFC 6020.
+ *
+ * The pattern Statement
+ *
+ * The "pattern" statement, which is an optional sub-statement to the
+ * "type" statement, takes as an argument a regular expression string.
+ * It is used to restrict the built-in type "string", or types derived
+ * from "string", to values that match the pattern.
+ *
+ * If the type has multiple "pattern" statements, the expressions are
+ * ANDed together, i.e., all such expressions have to match.
+ *
+ * If a pattern restriction is applied to an already pattern-restricted
+ * type, values must match all patterns in the base type, in addition to
+ * the new patterns.
+ * The pattern's sub-statements
+ *
+ * +---------------+---------+-------------+
+ * | substatement | section | cardinality |
+ * +---------------+---------+-------------+
+ * | description | 7.19.3 | 0..1 |
+ * | error-app-tag | 7.5.4.2 | 0..1 |
+ * | error-message | 7.5.4.1 | 0..1 |
+ * | reference | 7.19.4 | 0..1 |
+ * +---------------+---------+-------------+
+ */
+/**
+ * Pattern restriction information. The regular expression restriction on string
+ * data type.
+ */
+public class YangPatternRestriction {
+
+ /**
+ * Pattern restriction defined for the current type.
+ */
+ private List<String> pattern;
+
+ /**
+ * Effective pattern restriction that needs inherited from base type.
+ */
+ private List<String> basePattern;
+
+ /**
+ * Default constructor.
+ */
+ public YangPatternRestriction() {
+ }
+
+ /**
+ * Get the pattern restriction defined for the current type.
+ *
+ * @return pattern restriction defined for the current type.
+ */
+ public List<String> getPattern() {
+ return pattern;
+ }
+
+ /**
+ * Set the pattern restriction defined for the current type.
+ *
+ * @param pattern pattern restriction defined for the current type..
+ */
+ public void setPattern(List<String> pattern) {
+ this.pattern = pattern;
+ }
+
+ /**
+ * Get the pattern restriction defined in base type.
+ *
+ * @return pattern restriction defined in base type.
+ */
+ public List<String> getBasePattern() {
+ return basePattern;
+ }
+
+ /**
+ * Set the pattern restriction defined in base type.
+ *
+ * @param basePattern pattern restriction defined in base type.
+ */
+ public void setBasePattern(List<String> basePattern) {
+ this.basePattern = basePattern;
+ }
+}
diff --git a/utils/yangutils/src/main/java/org/onosproject/yangutils/datamodel/YangRangeInterval.java b/utils/yangutils/src/main/java/org/onosproject/yangutils/datamodel/YangRangeInterval.java
new file mode 100644
index 0000000..d3061a7
--- /dev/null
+++ b/utils/yangutils/src/main/java/org/onosproject/yangutils/datamodel/YangRangeInterval.java
@@ -0,0 +1,75 @@
+/*Copyright 2016.year Open Networking Laboratory
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.*/
+package org.onosproject.yangutils.datamodel;
+
+/**
+ * Single interval information of a range.
+ *
+ * @param <T> range type based on the data type.
+ */
+public class YangRangeInterval<T extends Comparable<T>> {
+
+ /**
+ * Starting value of the range interval.
+ */
+ private T startValue;
+
+ /**
+ * Last value of the range interval.
+ */
+ private T endValue;
+
+ /**
+ * Default constructor.
+ */
+ public YangRangeInterval() {
+ }
+
+ /**
+ * Get the starting value of the range interval.
+ *
+ * @return the starting value of the range interval.
+ */
+ public T getStartValue() {
+ return startValue;
+ }
+
+ /**
+ * Set the starting value of the range interval.
+ *
+ * @param startValue the starting value of the range interval.
+ */
+ public void setStartValue(T startValue) {
+ this.startValue = startValue;
+ }
+
+ /**
+ * Get the last value of the range interval.
+ *
+ * @return last value of the range interval.
+ */
+ public T getEndValue() {
+ return endValue;
+ }
+
+ /**
+ * Set the last value of the range interval.
+ *
+ * @param endValue last value of the range interval.
+ */
+ public void setEndValue(T endValue) {
+ this.endValue = endValue;
+ }
+
+}
diff --git a/utils/yangutils/src/main/java/org/onosproject/yangutils/datamodel/YangRangeRestriction.java b/utils/yangutils/src/main/java/org/onosproject/yangutils/datamodel/YangRangeRestriction.java
new file mode 100644
index 0000000..abbc6c2
--- /dev/null
+++ b/utils/yangutils/src/main/java/org/onosproject/yangutils/datamodel/YangRangeRestriction.java
@@ -0,0 +1,253 @@
+/*Copyright 2016.year Open Networking Laboratory
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.*/
+package org.onosproject.yangutils.datamodel;
+
+import java.util.LinkedList;
+import java.util.List;
+
+import org.onosproject.yangutils.datamodel.exceptions.DataModelException;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+
+/*-
+ * Reference RFC 6020.
+ *
+ * The range Statement
+ *
+ * The "range" statement, which is an optional sub-statement to the
+ * "type" statement, takes as an argument a range expression string. It
+ * is used to restrict integer and decimal built-in types, or types
+ * derived from those.
+ *
+ * A range consists of an explicit value, or a lower-inclusive bound,
+ * two consecutive dots "..", and an upper-inclusive bound. Multiple
+ * values or ranges can be given, separated by "|". If multiple values
+ * or ranges are given, they all MUST be disjoint and MUST be in
+ * ascending order. If a range restriction is applied to an already
+ * range-restricted type, the new restriction MUST be equal or more
+ * limiting, that is raising the lower bounds, reducing the upper
+ * bounds, removing explicit values or ranges, or splitting ranges into
+ * multiple ranges with intermediate gaps. Each explicit value and
+ * range boundary value given in the range expression MUST match the
+ * type being restricted, or be one of the special values "min" or
+ * "max". "min" and "max" mean the minimum and maximum value accepted
+ * for the type being restricted, respectively.
+ */
+/**
+ * Ascending range restriction information.
+ *
+ * @param <T> range type (data type)
+ */
+public class YangRangeRestriction<T extends Comparable<T>> implements YangDesc, YangReference, YangAppErrorInfo {
+
+ /**
+ * Ascending list of range interval restriction. If the restriction is a
+ * single value, the start and end length of the range is same.
+ */
+ private List<YangRangeInterval<T>> ascendingRangeIntervals;
+
+ /**
+ * Textual reference.
+ */
+ private String reference;
+
+ /**
+ * Application's error message, to be used for data error.
+ */
+ private String errorMessage;
+
+ /**
+ * Application's error tag, to be filled in data validation error response.
+ */
+ private String errorAppTag;
+
+ /**
+ * Textual description.
+ */
+ private String description;
+
+ /**
+ * Default constructor.
+ */
+ public YangRangeRestriction() {
+ }
+
+ /**
+ * Get the list of range interval restriction in ascending order.
+ *
+ * @return list of range interval restriction in ascending order.
+ */
+ public List<YangRangeInterval<T>> getAscendingRangeIntervals() {
+ return ascendingRangeIntervals;
+ }
+
+ /**
+ * Set the list of range interval restriction in ascending order.
+ *
+ * @param rangeList list of range interval restriction in ascending order.
+ */
+ private void setAscendingRangeIntervals(List<YangRangeInterval<T>> rangeList) {
+ ascendingRangeIntervals = rangeList;
+ }
+
+ /**
+ * Get the minimum valid value as per the restriction.
+ *
+ * @throws DataModelException data model exception for minimum restriction.
+ *
+ * @return minimum restricted value.
+ */
+ public T getMinRestrictedvalue() throws DataModelException {
+ if (getAscendingRangeIntervals() == null) {
+ throw new DataModelException("No range restriction info");
+ }
+ if (getAscendingRangeIntervals().size() == 0) {
+ throw new DataModelException("No range interval info");
+ }
+ return getAscendingRangeIntervals().get(0).getStartValue();
+ }
+
+ /**
+ * Get the maximum valid value as per the restriction.
+ *
+ * @throws DataModelException data model exception for maximum restriction.
+ *
+ * @return minimum maximum value.
+ */
+ public T getMaxRestrictedvalue() throws DataModelException {
+ if (getAscendingRangeIntervals() == null) {
+ throw new DataModelException("No range restriction info");
+ }
+ if (getAscendingRangeIntervals().size() == 0) {
+ throw new DataModelException("No range interval info");
+ }
+ return getAscendingRangeIntervals()
+ .get(getAscendingRangeIntervals().size() - 1).getEndValue();
+ }
+
+ /**
+ * Add new interval to extend its range in the last. i.e. newly added
+ * interval needs to be bigger than the biggest interval in the list.
+ *
+ * @param newInterval restricted length interval.
+ * @throws DataModelException data model exception for range restriction.
+ */
+ public void addLenghtRestrictionInterval(YangRangeInterval<T> newInterval) throws DataModelException {
+
+ checkNotNull(newInterval);
+ checkNotNull(newInterval.getStartValue());
+
+ if (getAscendingRangeIntervals() == null) {
+ /*
+ * First interval that is being added, and it must be the smallest
+ * interval.
+ */
+ setAscendingRangeIntervals(new LinkedList<YangRangeInterval<T>>());
+ getAscendingRangeIntervals().add(newInterval);
+ return;
+ }
+
+ T curMaxvalue = getMaxRestrictedvalue();
+
+ if (newInterval.getStartValue().compareTo(curMaxvalue) != 1) {
+ throw new DataModelException(
+ "New added range interval is lesser than the old interval(s)");
+ }
+
+ getAscendingRangeIntervals()
+ .add(getAscendingRangeIntervals().size(), newInterval);
+ }
+
+ /**
+ * Get the textual reference of the length restriction.
+ *
+ * @return textual reference of the length restriction.
+ */
+ @Override
+ public String getReference() {
+ return reference;
+ }
+
+ /**
+ * Set the textual reference of the length restriction.
+ *
+ * @param ref textual reference of the length restriction.
+ */
+ @Override
+ public void setReference(String ref) {
+ reference = ref;
+ }
+
+ /**
+ * Get the description of the length restriction.
+ *
+ * @return description of the length restriction.
+ */
+ @Override
+ public String getDescription() {
+ return description;
+ }
+
+ /**
+ * Set the description of the length restriction.
+ *
+ * @param desc description of the length restriction.
+ */
+ @Override
+ public void setDescription(String desc) {
+ description = desc;
+
+ }
+
+ /**
+ * Get application's error message, to be used for data error.
+ *
+ * @return Application's error message, to be used for data error.
+ */
+ @Override
+ public String getGetErrorMessage() {
+ return errorMessage;
+ }
+
+ /**
+ * Set Application's error message, to be used for data error.
+ *
+ * @param errMsg Application's error message, to be used for data error.
+ */
+ @Override
+ public void setErrorMessage(String errMsg) {
+ errorMessage = errMsg;
+
+ }
+
+ /**
+ * Get application's error tag, to be used for data error.
+ *
+ * @return application's error tag, to be used for data error.
+ */
+ @Override
+ public String getGetErrorAppTag() {
+ return errorAppTag;
+ }
+
+ /**
+ * Set application's error tag, to be used for data error.
+ *
+ * @param errTag application's error tag, to be used for data error.
+ */
+ @Override
+ public void setErrorAppTag(String errTag) {
+ errorAppTag = errTag;
+ }
+}
diff --git a/utils/yangutils/src/main/java/org/onosproject/yangutils/datamodel/YangRevision.java b/utils/yangutils/src/main/java/org/onosproject/yangutils/datamodel/YangRevision.java
index 7fb293d..8989262 100644
--- a/utils/yangutils/src/main/java/org/onosproject/yangutils/datamodel/YangRevision.java
+++ b/utils/yangutils/src/main/java/org/onosproject/yangutils/datamodel/YangRevision.java
@@ -88,6 +88,7 @@
*
* @return the description.
*/
+ @Override
public String getDescription() {
return description;
}
@@ -97,6 +98,7 @@
*
* @param description set the description.
*/
+ @Override
public void setDescription(String description) {
this.description = description;
}
@@ -106,6 +108,7 @@
*
* @return the reference.
*/
+ @Override
public String getReference() {
return reference;
}
@@ -115,6 +118,7 @@
*
* @param reference the reference to set.
*/
+ @Override
public void setReference(String reference) {
this.reference = reference;
}
@@ -124,6 +128,7 @@
*
* @return returns REVISION_DATA.
*/
+ @Override
public ParsableDataType getParsableDataType() {
return ParsableDataType.REVISION_DATA;
}
@@ -133,6 +138,7 @@
*
* @throws DataModelException a violation of data model rules.
*/
+ @Override
public void validateDataOnEntry() throws DataModelException {
// TODO auto-generated method stub, to be implemented by parser
@@ -143,6 +149,7 @@
*
* @throws DataModelException a violation of data model rules.
*/
+ @Override
public void validateDataOnExit() throws DataModelException {
// TODO auto-generated method stub, to be implemented by parser
diff --git a/utils/yangutils/src/main/java/org/onosproject/yangutils/datamodel/YangStringRestriction.java b/utils/yangutils/src/main/java/org/onosproject/yangutils/datamodel/YangStringRestriction.java
new file mode 100644
index 0000000..9cccaee
--- /dev/null
+++ b/utils/yangutils/src/main/java/org/onosproject/yangutils/datamodel/YangStringRestriction.java
@@ -0,0 +1,115 @@
+/*Copyright 2016.year Open Networking Laboratory
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.*/
+package org.onosproject.yangutils.datamodel;
+
+import java.math.BigInteger;
+
+/*-
+ * Reference RFC 6020.
+ *
+ * A string can be restricted with the "length" and "pattern" statements.
+ *
+ */
+/**
+ * The restriction for string data type.
+ */
+public class YangStringRestriction {
+
+ /*-
+ * Reference RFC 6020.
+ * The length Statement
+ *
+ * The "length" statement, which is an optional sub-statement to the
+ * "type" statement, takes as an argument a length expression string.
+ * It is used to restrict the built-in type "string", or types derived
+ * from "string".
+ * A "length" statement restricts the number of unicode characters in
+ * the string.
+ * A length range consists of an explicit value, or a lower bound, two
+ * consecutive dots "..", and an upper bound. Multiple values or ranges
+ * can be given, separated by "|". Length-restricting values MUST NOT
+ * be negative. If multiple values or ranges are given, they all MUST
+ * be disjoint and MUST be in ascending order. If a length restriction
+ * is applied to an already length-restricted type, the new restriction
+ * MUST be equal or more limiting, that is, raising the lower bounds,
+ * reducing the upper bounds, removing explicit length values or ranges,
+ * or splitting ranges into multiple ranges with intermediate gaps. A
+ * length value is a non-negative integer, or one of the special values
+ * "min" or "max". "min" and "max" mean the minimum and maximum length
+ * accepted for the type being restricted, respectively. An
+ * implementation is not required to support a length value larger than
+ * 18446744073709551615.
+ * The length's sub-statements
+ *
+ * +---------------+---------+-------------+-----------------+
+ * | substatement | section | cardinality | mapped data type|
+ * +---------------+---------+-------------+-----------------+
+ * | description | 7.19.3 | 0..1 | string |
+ * | error-app-tag | 7.5.4.2 | 0..1 | string |
+ * | error-message | 7.5.4.1 | 0..1 | string |
+ * | reference | 7.19.4 | 0..1 | string |
+ * +---------------+---------+-------------+-----------------+
+ */
+ /**
+ * Length restriction information.
+ */
+ private YangRangeRestriction<BigInteger> lengthRestriction;
+
+ /**
+ * Effective pattern restriction for the type.
+ */
+ private YangPatternRestriction patternRestriction;
+
+ /**
+ * Default constructor.
+ */
+ public YangStringRestriction() {
+ }
+
+ /**
+ * Get the length restriction on the string data.
+ *
+ * @return length restriction on the string data.
+ */
+ public YangRangeRestriction<BigInteger> getLengthRestriction() {
+ return lengthRestriction;
+ }
+
+ /**
+ * Set the length restriction on the string data.
+ *
+ * @param lengthRestriction length restriction on the string data.
+ */
+ public void setLengthRestriction(YangRangeRestriction<BigInteger> lengthRestriction) {
+ this.lengthRestriction = lengthRestriction;
+ }
+
+ /**
+ * Get the pattern restriction for the type.
+ *
+ * @return pattern restriction for the type.
+ */
+ public YangPatternRestriction getPatternRestriction() {
+ return patternRestriction;
+ }
+
+ /**
+ * Set the pattern restriction for the type.
+ *
+ * @param patternRestriction pattern restriction for the type.
+ */
+ public void setPatternRestriction(YangPatternRestriction patternRestriction) {
+ this.patternRestriction = patternRestriction;
+ }
+}
diff --git a/utils/yangutils/src/main/java/org/onosproject/yangutils/datamodel/YangSubModule.java b/utils/yangutils/src/main/java/org/onosproject/yangutils/datamodel/YangSubModule.java
index 04b7cfb..467217e 100644
--- a/utils/yangutils/src/main/java/org/onosproject/yangutils/datamodel/YangSubModule.java
+++ b/utils/yangutils/src/main/java/org/onosproject/yangutils/datamodel/YangSubModule.java
@@ -73,7 +73,8 @@
/**
* Data model node to maintain information defined in YANG sub-module.
*/
-public class YangSubModule extends YangNode implements YangLeavesHolder, YangDesc, YangReference, Parsable {
+public class YangSubModule extends YangNode
+ implements YangLeavesHolder, YangDesc, YangReference, Parsable {
/**
* Name of sub module.
@@ -114,12 +115,12 @@
/**
* List of leaves at root level in the sub-module.
*/
- private List<YangLeaf<?>> listOfLeaf;
+ private List<YangLeaf> listOfLeaf;
/**
* List of leaf-lists at root level in the sub-module.
*/
- private List<YangLeafList<?>> listOfLeafList;
+ private List<YangLeafList> listOfLeafList;
/**
* organization owner of the sub-module.
@@ -142,22 +143,31 @@
private byte version;
/**
+ * package of the generated java code.
+ */
+ private String pkg;
+
+ /**
* Create a sub module node.
*/
public YangSubModule() {
super(YangNodeType.SUB_MODULE_NODE);
}
- /* (non-Javadoc)
- * @see org.onosproject.yangutils.datamodel.YangNode#getName()
+ /**
+ * Get the YANG name of the sub module.
+ *
+ * @return YANG name of the sub module
*/
@Override
public String getName() {
return name;
}
- /* (non-Javadoc)
- * @see org.onosproject.yangutils.datamodel.YangNode#setName(java.lang.String)
+ /**
+ * Set YANG name of the sub module.
+ *
+ * @param subModuleName YANG name of the sub module
*/
@Override
public void setName(String subModuleName) {
@@ -293,7 +303,7 @@
* @return the list of leaves.
*/
@Override
- public List<YangLeaf<?>> getListOfLeaf() {
+ public List<YangLeaf> getListOfLeaf() {
return listOfLeaf;
}
@@ -302,7 +312,7 @@
*
* @param leafsList the list of leaf to set.
*/
- private void setListOfLeaf(List<YangLeaf<?>> leafsList) {
+ private void setListOfLeaf(List<YangLeaf> leafsList) {
listOfLeaf = leafsList;
}
@@ -312,9 +322,9 @@
* @param leaf the leaf to be added.
*/
@Override
- public void addLeaf(YangLeaf<?> leaf) {
+ public void addLeaf(YangLeaf leaf) {
if (getListOfLeaf() == null) {
- setListOfLeaf(new LinkedList<YangLeaf<?>>());
+ setListOfLeaf(new LinkedList<YangLeaf>());
}
getListOfLeaf().add(leaf);
@@ -326,7 +336,7 @@
* @return the list of leaf-list.
*/
@Override
- public List<YangLeafList<?>> getListOfLeafList() {
+ public List<YangLeafList> getListOfLeafList() {
return listOfLeafList;
}
@@ -335,7 +345,7 @@
*
* @param listOfLeafList the list of leaf-list to set.
*/
- private void setListOfLeafList(List<YangLeafList<?>> listOfLeafList) {
+ private void setListOfLeafList(List<YangLeafList> listOfLeafList) {
this.listOfLeafList = listOfLeafList;
}
@@ -345,9 +355,9 @@
* @param leafList the leaf-list to be added.
*/
@Override
- public void addLeafList(YangLeafList<?> leafList) {
+ public void addLeafList(YangLeafList leafList) {
if (getListOfLeafList() == null) {
- setListOfLeafList(new LinkedList<YangLeafList<?>>());
+ setListOfLeafList(new LinkedList<YangLeafList>());
}
getListOfLeafList().add(leafList);
@@ -457,17 +467,16 @@
// TODO auto-generated method stub, to be implemented by parser
}
- /* (non-Javadoc)
- * @see org.onosproject.yangutils.translator.CodeGenerator#generateJavaCodeEntry()
+ /**
+ * Generates java code for sub-module.
*/
@Override
public void generateJavaCodeEntry() {
// TODO Auto-generated method stub
-
}
- /* (non-Javadoc)
- * @see org.onosproject.yangutils.translator.CodeGenerator#generateJavaCodeExit()
+ /**
+ * Free resources used to generate code.
*/
@Override
public void generateJavaCodeExit() {
@@ -475,22 +484,24 @@
}
- /* (non-Javadoc)
- * @see org.onosproject.yangutils.datamodel.YangNode#getPackage()
+ /**
+ * Get the mapped java package.
+ *
+ * @return the java package
*/
@Override
public String getPackage() {
- // TODO Auto-generated method stub
- return null;
+ return pkg;
}
- /* (non-Javadoc)
- * @see org.onosproject.yangutils.datamodel.YangNode#setPackage(java.lang.String)
+ /**
+ * Set the mapped java package.
+ *
+ * @param pakg the package to set
*/
@Override
- public void setPackage(String pkg) {
- // TODO Auto-generated method stub
-
+ public void setPackage(String pakg) {
+ pkg = pakg;
}
@Override
diff --git a/utils/yangutils/src/main/java/org/onosproject/yangutils/datamodel/YangType.java b/utils/yangutils/src/main/java/org/onosproject/yangutils/datamodel/YangType.java
index d09a1e5..723319d 100644
--- a/utils/yangutils/src/main/java/org/onosproject/yangutils/datamodel/YangType.java
+++ b/utils/yangutils/src/main/java/org/onosproject/yangutils/datamodel/YangType.java
@@ -61,7 +61,12 @@
*/
private YangDataTypes dataType;
- private T dataTypeInfo;
+ /**
+ * Additional information about data type, example restriction info, named
+ * values, etc. The extra information is based on the data type. Based on
+ * the data type, the extended info can vary.
+ */
+ private T dataTypeExtendedInfo;
/**
* Default constructor.
@@ -110,8 +115,8 @@
*
* @return the data type meta data.
*/
- public T getDataTypeInfo() {
- return dataTypeInfo;
+ public T getDataTypeExtendedInfo() {
+ return dataTypeExtendedInfo;
}
/**
@@ -119,8 +124,8 @@
*
* @param dataTypeInfo the meta data to set
*/
- public void setDataTypeInfo(T dataTypeInfo) {
- this.dataTypeInfo = dataTypeInfo;
+ public void setDataTypeExtendedInfo(T dataTypeInfo) {
+ this.dataTypeExtendedInfo = dataTypeInfo;
}
/**
@@ -128,6 +133,7 @@
*
* @return returns TYPE_DATA.
*/
+ @Override
public ParsableDataType getParsableDataType() {
return ParsableDataType.TYPE_DATA;
}
@@ -137,6 +143,7 @@
*
* @throws DataModelException a violation of data model rules.
*/
+ @Override
public void validateDataOnEntry() throws DataModelException {
// TODO auto-generated method stub, to be implemented by parser
@@ -147,6 +154,7 @@
*
* @throws DataModelException a violation of data model rules.
*/
+ @Override
public void validateDataOnExit() throws DataModelException {
// TODO auto-generated method stub, to be implemented by parser
diff --git a/utils/yangutils/src/main/java/org/onosproject/yangutils/datamodel/YangTypeDef.java b/utils/yangutils/src/main/java/org/onosproject/yangutils/datamodel/YangTypeDef.java
index a1abb0d..0ce074e 100644
--- a/utils/yangutils/src/main/java/org/onosproject/yangutils/datamodel/YangTypeDef.java
+++ b/utils/yangutils/src/main/java/org/onosproject/yangutils/datamodel/YangTypeDef.java
@@ -81,10 +81,14 @@
private YangStatusType status;
/**
- * Derived data type.
+ * Derived data type. The type will be set when the parser detects the type
+ * parsing. Hence it is of raw type and it not know at the time of creation
+ * of the object. i.e. in entry parse, it will not be know, in the exit
+ * parse we may know the type implicitly based on the restriction. We must
+ * know and validate the base built in type, by the linking phase. It is a
+ * RAW type and it usage needs to be validate in linking phase.
*/
- @SuppressWarnings("rawtypes")
- private YangType derivedType;
+ private YangType<?> derivedType;
/**
* Units of the data type.
@@ -92,6 +96,16 @@
private String units;
/**
+ * YANG base built in data type.
+ */
+ private YangDataTypes baseBuiltInType;
+
+ /**
+ * package of the generated java code.
+ */
+ private String pkg;
+
+ /**
* Create a typedef node.
*/
public YangTypeDef() {
@@ -199,8 +213,7 @@
*
* @return the referenced type.
*/
- @SuppressWarnings("rawtypes")
- public YangType getDerivedType() {
+ public YangType<?> getDerivedType() {
return derivedType;
}
@@ -209,8 +222,7 @@
*
* @param derivedType the referenced type.
*/
- @SuppressWarnings("rawtypes")
- public void setDerivedType(YangType derivedType) {
+ public void setDerivedType(YangType<?> derivedType) {
this.derivedType = derivedType;
}
@@ -233,6 +245,24 @@
}
/**
+ * Get the base built in YANG data type.
+ *
+ * @return base built in YANG data type.
+ */
+ public YangDataTypes getBaseBuiltInType() {
+ return baseBuiltInType;
+ }
+
+ /**
+ * Set the base built in YANG data type.
+ *
+ * @param baseBuiltInType base built in YANG data type.
+ */
+ public void setBaseBuiltInType(YangDataTypes baseBuiltInType) {
+ this.baseBuiltInType = baseBuiltInType;
+ }
+
+ /**
* Returns the type of the data.
*
* @return returns TYPEDEF_DATA
@@ -262,17 +292,20 @@
// TODO auto-generated method stub, to be implemented by parser
}
- /* (non-Javadoc)
- * @see org.onosproject.yangutils.datamodel.YangNode#getName()
+ /**
+ * Get the YANG name of the typedef.
+ *
+ * @return YANG name of the typedef.
*/
@Override
public String getName() {
- // TODO Auto-generated method stub
- return null;
+ return derivedName;
}
- /* (non-Javadoc)
- * @see org.onosproject.yangutils.datamodel.YangNode#setName(java.lang.String)
+ /**
+ * Set YANG name of the typedef.
+ *
+ * @param name YANG name of the typedef.
*/
@Override
public void setName(String name) {
@@ -280,8 +313,8 @@
}
- /* (non-Javadoc)
- * @see org.onosproject.yangutils.translator.CodeGenerator#generateJavaCodeEntry()
+ /**
+ * Generate java code snippet corresponding to YANG typedef.
*/
@Override
public void generateJavaCodeEntry() {
@@ -289,8 +322,8 @@
}
- /* (non-Javadoc)
- * @see org.onosproject.yangutils.translator.CodeGenerator#generateJavaCodeExit()
+ /**
+ * Free resource used for code generation of YANG typedef.
*/
@Override
public void generateJavaCodeExit() {
@@ -298,30 +331,43 @@
}
- /* (non-Javadoc)
- * @see org.onosproject.yangutils.datamodel.YangNode#getPackage()
+ /**
+ * Get the mapped java package.
+ *
+ * @return the java package
*/
@Override
public String getPackage() {
- // TODO Auto-generated method stub
- return null;
+ return pkg;
}
- /* (non-Javadoc)
- * @see org.onosproject.yangutils.datamodel.YangNode#setPackage(java.lang.String)
+ /**
+ * Set the mapped java package.
+ *
+ * @param pakg mapped java package.
*/
@Override
- public void setPackage(String pkg) {
- // TODO Auto-generated method stub
+ public void setPackage(String pakg) {
+ pkg = pakg;
}
+ /**
+ * Get the file handle of the cached file used during code generation.
+ *
+ * @return cached file handle.
+ */
@Override
public CachedFileHandle getFileHandle() {
// TODO Auto-generated method stub
return null;
}
+ /**
+ * Set the file handle to be used used for code generation.
+ *
+ * @param fileHandle cached file handle.
+ */
@Override
public void setFileHandle(CachedFileHandle fileHandle) {
// TODO Auto-generated method stub
diff --git a/utils/yangutils/src/main/java/org/onosproject/yangutils/parser/antlrgencode/GeneratedYangListener.java b/utils/yangutils/src/main/java/org/onosproject/yangutils/parser/antlrgencode/GeneratedYangListener.java
index 9bb54aa..236a65b 100644
--- a/utils/yangutils/src/main/java/org/onosproject/yangutils/parser/antlrgencode/GeneratedYangListener.java
+++ b/utils/yangutils/src/main/java/org/onosproject/yangutils/parser/antlrgencode/GeneratedYangListener.java
@@ -909,8 +909,8 @@
*
* @param currentContext current context in the parsed tree.
*/
- void enterInstanceIdentifierSpecification(GeneratedYangParser.InstanceIdentifierSpecificationContext
- currentContext);
+ void enterInstanceIdentifierSpecification(
+ GeneratedYangParser.InstanceIdentifierSpecificationContext currentContext);
/**
* Exit a parse tree produced by GeneratedYangParser for grammar rule
diff --git a/utils/yangutils/src/main/java/org/onosproject/yangutils/parser/impl/TreeWalkListener.java b/utils/yangutils/src/main/java/org/onosproject/yangutils/parser/impl/TreeWalkListener.java
index 187c600..c0c128b 100644
--- a/utils/yangutils/src/main/java/org/onosproject/yangutils/parser/impl/TreeWalkListener.java
+++ b/utils/yangutils/src/main/java/org/onosproject/yangutils/parser/impl/TreeWalkListener.java
@@ -16,6 +16,8 @@
package org.onosproject.yangutils.parser.impl;
+import java.util.Stack;
+
import org.antlr.v4.runtime.ParserRuleContext;
import org.antlr.v4.runtime.tree.ErrorNode;
import org.antlr.v4.runtime.tree.TerminalNode;
@@ -23,20 +25,19 @@
import org.onosproject.yangutils.parser.Parsable;
import org.onosproject.yangutils.parser.antlrgencode.GeneratedYangListener;
import org.onosproject.yangutils.parser.antlrgencode.GeneratedYangParser;
-
+import org.onosproject.yangutils.parser.impl.listeners.BaseFileListener;
+import org.onosproject.yangutils.parser.impl.listeners.BelongsToListener;
+import org.onosproject.yangutils.parser.impl.listeners.ConfigListener;
+import org.onosproject.yangutils.parser.impl.listeners.ContactListener;
+import org.onosproject.yangutils.parser.impl.listeners.ContainerListener;
import org.onosproject.yangutils.parser.impl.listeners.DefaultListener;
+import org.onosproject.yangutils.parser.impl.listeners.DescriptionListener;
+import org.onosproject.yangutils.parser.impl.listeners.ImportListener;
+import org.onosproject.yangutils.parser.impl.listeners.IncludeListener;
import org.onosproject.yangutils.parser.impl.listeners.KeyListener;
import org.onosproject.yangutils.parser.impl.listeners.LeafListListener;
import org.onosproject.yangutils.parser.impl.listeners.LeafListener;
import org.onosproject.yangutils.parser.impl.listeners.ListListener;
-import org.onosproject.yangutils.parser.impl.listeners.ContainerListener;
-import org.onosproject.yangutils.parser.impl.listeners.ConfigListener;
-import org.onosproject.yangutils.parser.impl.listeners.ContactListener;
-import org.onosproject.yangutils.parser.impl.listeners.BaseFileListener;
-import org.onosproject.yangutils.parser.impl.listeners.BelongsToListener;
-import org.onosproject.yangutils.parser.impl.listeners.DescriptionListener;
-import org.onosproject.yangutils.parser.impl.listeners.ImportListener;
-import org.onosproject.yangutils.parser.impl.listeners.IncludeListener;
import org.onosproject.yangutils.parser.impl.listeners.MandatoryListener;
import org.onosproject.yangutils.parser.impl.listeners.MaxElementsListener;
import org.onosproject.yangutils.parser.impl.listeners.MinElementsListener;
@@ -54,9 +55,6 @@
import org.onosproject.yangutils.parser.impl.listeners.TypeListener;
import org.onosproject.yangutils.parser.impl.listeners.UnitsListener;
import org.onosproject.yangutils.parser.impl.listeners.VersionListener;
-import org.onosproject.yangutils.parser.impl.parserutils.ListenerError;
-
-import java.util.Stack;
/**
* ANTLR generates a parse-tree listener interface that responds to events
@@ -72,9 +70,6 @@
// Parse tree root node
private YangNode rootNode;
- // Maintains the state of Exception.
- private ListenerError errorInformation = new ListenerError();
-
/**
* Returns stack of parsable data.
*
@@ -85,15 +80,6 @@
}
/**
- * Returns error information.
- *
- * @return error information object having exception flag and message
- */
- public ListenerError getErrorInformation() {
- return errorInformation;
- }
-
- /**
* Returns root node.
*
* @return rootNode of data model tree.
@@ -120,15 +106,6 @@
this.rootNode = rootNode;
}
- /**
- * Set listener error information.
- *
- * @param errorInformation error occurred during tree walk.
- */
- public void setErrorInformation(ListenerError errorInformation) {
- this.errorInformation = errorInformation;
- }
-
@Override
public void enterYangfile(GeneratedYangParser.YangfileContext ctx) {
BaseFileListener.processYangFileEntry(this, ctx);
diff --git a/utils/yangutils/src/main/java/org/onosproject/yangutils/parser/impl/listeners/ConfigListener.java b/utils/yangutils/src/main/java/org/onosproject/yangutils/parser/impl/listeners/ConfigListener.java
index 9c951ae..49c0348 100644
--- a/utils/yangutils/src/main/java/org/onosproject/yangutils/parser/impl/listeners/ConfigListener.java
+++ b/utils/yangutils/src/main/java/org/onosproject/yangutils/parser/impl/listeners/ConfigListener.java
@@ -59,15 +59,14 @@
}
/**
- * It is called when parser receives an input matching the grammar
- * rule (config), performs validation and updates the data model
- * tree.
+ * It is called when parser receives an input matching the grammar rule
+ * (config), performs validation and updates the data model tree.
*
* @param listener listener's object.
* @param ctx context object of the grammar rule.
*/
public static void processConfigEntry(TreeWalkListener listener,
- GeneratedYangParser.ConfigStatementContext ctx) {
+ GeneratedYangParser.ConfigStatementContext ctx) {
boolean isConfig = false;
// Check for stack to be non empty.
diff --git a/utils/yangutils/src/main/java/org/onosproject/yangutils/parser/impl/listeners/TypeDefListener.java b/utils/yangutils/src/main/java/org/onosproject/yangutils/parser/impl/listeners/TypeDefListener.java
index 9d41253..d2f90ce 100644
--- a/utils/yangutils/src/main/java/org/onosproject/yangutils/parser/impl/listeners/TypeDefListener.java
+++ b/utils/yangutils/src/main/java/org/onosproject/yangutils/parser/impl/listeners/TypeDefListener.java
@@ -56,26 +56,27 @@
import org.onosproject.yangutils.datamodel.exceptions.DataModelException;
import org.onosproject.yangutils.parser.Parsable;
import org.onosproject.yangutils.parser.ParsableDataType;
-import static org.onosproject.yangutils.parser.ParsableDataType.TYPEDEF_DATA;
-import static org.onosproject.yangutils.parser.ParsableDataType.UNITS_DATA;
-import static org.onosproject.yangutils.parser.ParsableDataType.DEFAULT_DATA;
-import static org.onosproject.yangutils.parser.ParsableDataType.TYPE_DATA;
-import static org.onosproject.yangutils.parser.ParsableDataType.DESCRIPTION_DATA;
-import static org.onosproject.yangutils.parser.ParsableDataType.REFERENCE_DATA;
-import static org.onosproject.yangutils.parser.ParsableDataType.STATUS_DATA;
import org.onosproject.yangutils.parser.antlrgencode.GeneratedYangParser;
import org.onosproject.yangutils.parser.exceptions.ParserException;
import org.onosproject.yangutils.parser.impl.TreeWalkListener;
import org.onosproject.yangutils.parser.impl.YangUtilsParserManager;
+
+import static org.onosproject.yangutils.parser.ParsableDataType.DEFAULT_DATA;
+import static org.onosproject.yangutils.parser.ParsableDataType.DESCRIPTION_DATA;
+import static org.onosproject.yangutils.parser.ParsableDataType.REFERENCE_DATA;
+import static org.onosproject.yangutils.parser.ParsableDataType.STATUS_DATA;
+import static org.onosproject.yangutils.parser.ParsableDataType.TYPEDEF_DATA;
+import static org.onosproject.yangutils.parser.ParsableDataType.TYPE_DATA;
+import static org.onosproject.yangutils.parser.ParsableDataType.UNITS_DATA;
import static org.onosproject.yangutils.parser.impl.parserutils.ListenerErrorLocation.ENTRY;
import static org.onosproject.yangutils.parser.impl.parserutils.ListenerErrorLocation.EXIT;
import static org.onosproject.yangutils.parser.impl.parserutils.ListenerErrorMessageConstruction.constructExtendedListenerErrorMessage;
import static org.onosproject.yangutils.parser.impl.parserutils.ListenerErrorMessageConstruction.constructListenerErrorMessage;
-import static org.onosproject.yangutils.parser.impl.parserutils.ListenerErrorType.MISSING_HOLDER;
import static org.onosproject.yangutils.parser.impl.parserutils.ListenerErrorType.INVALID_CARDINALITY;
import static org.onosproject.yangutils.parser.impl.parserutils.ListenerErrorType.INVALID_HOLDER;
-import static org.onosproject.yangutils.parser.impl.parserutils.ListenerErrorType.UNHANDLED_PARSED_DATA;
import static org.onosproject.yangutils.parser.impl.parserutils.ListenerErrorType.MISSING_CURRENT_HOLDER;
+import static org.onosproject.yangutils.parser.impl.parserutils.ListenerErrorType.MISSING_HOLDER;
+import static org.onosproject.yangutils.parser.impl.parserutils.ListenerErrorType.UNHANDLED_PARSED_DATA;
import static org.onosproject.yangutils.parser.impl.parserutils.ListenerValidation.checkStackIsNotEmpty;
/**
@@ -115,8 +116,8 @@
Parsable curData = listener.getParsedDataStack().peek();
- if (curData instanceof YangModule | curData instanceof YangSubModule | curData instanceof YangContainer
- | curData instanceof YangList) {
+ if ((curData instanceof YangModule) | (curData instanceof YangSubModule) | (curData instanceof YangContainer)
+ | (curData instanceof YangList)) {
/*
* TODO YangGrouping, YangRpc, YangInput, YangOutput, Notification.
*/
@@ -150,7 +151,6 @@
if (listener.getParsedDataStack().peek() instanceof YangTypeDef) {
listener.getParsedDataStack().pop();
} else {
- listener.getErrorInformation().setErrorFlag(true);
throw new ParserException(constructListenerErrorMessage(MISSING_CURRENT_HOLDER, TYPEDEF_DATA,
ctx.IDENTIFIER().getText(), EXIT));
}
diff --git a/utils/yangutils/src/main/java/org/onosproject/yangutils/parser/impl/parserutils/ListenerError.java b/utils/yangutils/src/main/java/org/onosproject/yangutils/parser/impl/parserutils/ListenerError.java
deleted file mode 100644
index c5c3c8b..0000000
--- a/utils/yangutils/src/main/java/org/onosproject/yangutils/parser/impl/parserutils/ListenerError.java
+++ /dev/null
@@ -1,107 +0,0 @@
-/*
- * Copyright 2016 Open Networking Laboratory
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onosproject.yangutils.parser.impl.parserutils;
-
-/**
- * Error information while doing a listener's based walk is maintained in it.
- */
-public class ListenerError {
-
- // Maintains the state of exception.
- private boolean errorFlag = false;
-
- // Maintains the reason of exception.
- private String errorMsg;
-
- // Maintains the line number of exception.
- private int lineNumber;
-
- // Maintains the character position in lin of exception.
- private int charPositionInLine;
-
- /**
- * Returns error flag.
- *
- * @return error flag.
- */
- public boolean isErrorFlag() {
- return errorFlag;
- }
-
- /**
- * Returns reason for error.
- *
- * @return error message
- */
- public String getErrorMsg() {
- return errorMsg;
- }
-
- /**
- * Returns error line number.
- *
- * @return error line number.
- */
- public int getLineNumber() {
- return lineNumber;
- }
-
- /**
- * Returns error position in line.
- *
- * @return error character position in line.
- */
- public int getCharPositionInLine() {
- return charPositionInLine;
- }
-
- /**
- * Set error flag.
- *
- * @param errorFlag error existence flag.
- */
- public void setErrorFlag(boolean errorFlag) {
- this.errorFlag = errorFlag;
- }
-
- /**
- * Set error message.
- *
- * @param errorMsg reason for error.
- */
- public void setErrorMsg(String errorMsg) {
- this.errorMsg = errorMsg;
- }
-
- /**
- * Set error line number.
- *
- * @param lineNumber line number of error.
- */
- public void setLineNumber(int lineNumber) {
- this.lineNumber = lineNumber;
- }
-
- /**
- * Set error character position in line.
- *
- * @param charPositionInLine error character position in line.
- */
- public void setCharPositionInLine(int charPositionInLine) {
- this.charPositionInLine = charPositionInLine;
- }
-}
\ No newline at end of file
diff --git a/utils/yangutils/src/main/java/org/onosproject/yangutils/plugin/manager/YangUtilManager.java b/utils/yangutils/src/main/java/org/onosproject/yangutils/plugin/manager/YangUtilManager.java
index 8db668c..5ee4f5d 100644
--- a/utils/yangutils/src/main/java/org/onosproject/yangutils/plugin/manager/YangUtilManager.java
+++ b/utils/yangutils/src/main/java/org/onosproject/yangutils/plugin/manager/YangUtilManager.java
@@ -46,7 +46,7 @@
* in generate-sources requiresDependencyResolution at compile time
*/
@Mojo(name = "yang2java", defaultPhase = LifecyclePhase.GENERATE_SOURCES,
-requiresDependencyResolution = ResolutionScope.COMPILE, requiresProject = true)
+ requiresDependencyResolution = ResolutionScope.COMPILE, requiresProject = true)
public class YangUtilManager extends AbstractMojo {
/**
diff --git a/utils/yangutils/src/main/java/org/onosproject/yangutils/translator/tojava/utils/JavaCodeSnippetGen.java b/utils/yangutils/src/main/java/org/onosproject/yangutils/translator/tojava/utils/JavaCodeSnippetGen.java
index e8bade3..a470aef 100644
--- a/utils/yangutils/src/main/java/org/onosproject/yangutils/translator/tojava/utils/JavaCodeSnippetGen.java
+++ b/utils/yangutils/src/main/java/org/onosproject/yangutils/translator/tojava/utils/JavaCodeSnippetGen.java
@@ -16,6 +16,9 @@
package org.onosproject.yangutils.translator.tojava.utils;
+import java.util.List;
+import java.util.SortedSet;
+
import org.onosproject.yangutils.datamodel.YangType;
import org.onosproject.yangutils.translator.GeneratedFileType;
import org.onosproject.yangutils.translator.tojava.GeneratedMethodTypes;
@@ -47,6 +50,17 @@
}
/**
+ * reorder the import list based on the ONOS import rules.
+ *
+ * @param importInfo the set of classes/interfaces to be imported.
+ * @return string of import info.
+ */
+ public List<ImportInfo> sortImportOrder(SortedSet<ImportInfo> importInfo) {
+ /* TODO: reorder the import list based on the ONOS import rules. */
+ return null;
+ }
+
+ /**
* Get the textual java code information corresponding to the import list.
*
* @param importInfo import info.
diff --git a/utils/yangutils/src/main/java/org/onosproject/yangutils/translator/tojava/utils/MethodsGenerator.java b/utils/yangutils/src/main/java/org/onosproject/yangutils/translator/tojava/utils/MethodsGenerator.java
index 2092441..23b4afb 100644
--- a/utils/yangutils/src/main/java/org/onosproject/yangutils/translator/tojava/utils/MethodsGenerator.java
+++ b/utils/yangutils/src/main/java/org/onosproject/yangutils/translator/tojava/utils/MethodsGenerator.java
@@ -113,7 +113,6 @@
GeneratedMethodTypes methodTypes, YangType<?> returnType) {
if (returnType == null) {
- @SuppressWarnings("rawtypes")
YangType<?> type = new YangType();
type.setDataTypeName(yangName);
returnType = type;
diff --git a/utils/yangutils/src/main/java/org/onosproject/yangutils/utils/io/impl/FileSystemUtil.java b/utils/yangutils/src/main/java/org/onosproject/yangutils/utils/io/impl/FileSystemUtil.java
index cc4fa9d..f7e3556 100644
--- a/utils/yangutils/src/main/java/org/onosproject/yangutils/utils/io/impl/FileSystemUtil.java
+++ b/utils/yangutils/src/main/java/org/onosproject/yangutils/utils/io/impl/FileSystemUtil.java
@@ -62,7 +62,8 @@
public static void createPackage(String pkg, String pkgInfo) throws IOException {
if (!doesPackageExist(new File(pkg))) {
try {
- File pack = YangIoUtils.createDirectories(pkg.replace(UtilConstants.PERIOD, UtilConstants.SLASH));
+ File pack = YangIoUtils
+ .createDirectories(pkg.replace(UtilConstants.PERIOD, UtilConstants.SLASH));
YangIoUtils.addPackageInfo(pack, pkgInfo, pkg);
} catch (IOException e) {
throw new IOException("failed to create package-info file");
diff --git a/utils/yangutils/src/test/java/org/onosproject/yangutils/parser/impl/CustomExceptionMatcher.java b/utils/yangutils/src/test/java/org/onosproject/yangutils/parser/impl/CustomExceptionMatcher.java
index 9908da5..419632c 100644
--- a/utils/yangutils/src/test/java/org/onosproject/yangutils/parser/impl/CustomExceptionMatcher.java
+++ b/utils/yangutils/src/test/java/org/onosproject/yangutils/parser/impl/CustomExceptionMatcher.java
@@ -22,8 +22,8 @@
/**
* ExpectedException framework can use the Hamcrest matcher's to test
- * custom/extended exceptions. This class extends the type safe matcher to define
- * the custom exception matcher.
+ * custom/extended exceptions. This class extends the type safe matcher to
+ * define the custom exception matcher.
*/
public final class CustomExceptionMatcher extends TypeSafeMatcher<ParserException> {
diff --git a/utils/yangutils/src/test/java/org/onosproject/yangutils/parser/impl/listeners/ConfigListenerTest.java b/utils/yangutils/src/test/java/org/onosproject/yangutils/parser/impl/listeners/ConfigListenerTest.java
index ea3b6573..c8db91a 100644
--- a/utils/yangutils/src/test/java/org/onosproject/yangutils/parser/impl/listeners/ConfigListenerTest.java
+++ b/utils/yangutils/src/test/java/org/onosproject/yangutils/parser/impl/listeners/ConfigListenerTest.java
@@ -16,25 +16,24 @@
package org.onosproject.yangutils.parser.impl.listeners;
+import java.io.IOException;
+import java.util.ListIterator;
+
import org.junit.Rule;
import org.junit.Test;
-
import org.junit.rules.ExpectedException;
+import org.onosproject.yangutils.datamodel.YangContainer;
+import org.onosproject.yangutils.datamodel.YangDataTypes;
import org.onosproject.yangutils.datamodel.YangLeaf;
+import org.onosproject.yangutils.datamodel.YangLeafList;
+import org.onosproject.yangutils.datamodel.YangList;
import org.onosproject.yangutils.datamodel.YangModule;
import org.onosproject.yangutils.datamodel.YangNode;
import org.onosproject.yangutils.datamodel.YangNodeType;
-import org.onosproject.yangutils.datamodel.YangDataTypes;
import org.onosproject.yangutils.datamodel.YangStatusType;
-import org.onosproject.yangutils.datamodel.YangContainer;
-import org.onosproject.yangutils.datamodel.YangList;
-import org.onosproject.yangutils.datamodel.YangLeafList;
import org.onosproject.yangutils.parser.exceptions.ParserException;
import org.onosproject.yangutils.parser.impl.YangUtilsParserManager;
-import java.io.IOException;
-import java.util.ListIterator;
-
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.core.Is.is;
@@ -66,8 +65,8 @@
YangModule yangNode = (YangModule) node;
assertThat(yangNode.getName(), is("Test"));
- ListIterator<YangLeaf<?>> leafIterator = yangNode.getListOfLeaf().listIterator();
- YangLeaf<?> leafInfo = leafIterator.next();
+ ListIterator<YangLeaf> leafIterator = yangNode.getListOfLeaf().listIterator();
+ YangLeaf leafInfo = leafIterator.next();
// Check whether the Config value is set correctly.
assertThat(leafInfo.getLeafName(), is("invalid-interval"));
@@ -92,8 +91,8 @@
YangModule yangNode = (YangModule) node;
assertThat(yangNode.getName(), is("Test"));
- ListIterator<YangLeaf<?>> leafIterator = yangNode.getListOfLeaf().listIterator();
- YangLeaf<?> leafInfo = leafIterator.next();
+ ListIterator<YangLeaf> leafIterator = yangNode.getListOfLeaf().listIterator();
+ YangLeaf leafInfo = leafIterator.next();
// Check whether the Config value is set correctly.
assertThat(leafInfo.getLeafName(), is("invalid-interval"));
@@ -167,8 +166,8 @@
assertThat(container.isConfig(), is(true));
// Check whether leaf properties as set correctly.
- ListIterator<YangLeaf<?>> leafIterator = container.getListOfLeaf().listIterator();
- YangLeaf<?> leafInfo = leafIterator.next();
+ ListIterator<YangLeaf> leafIterator = container.getListOfLeaf().listIterator();
+ YangLeaf leafInfo = leafIterator.next();
assertThat(leafInfo.getLeafName(), is("invalid-interval"));
assertThat(leafInfo.getDataType().getDataTypeName(), is("\"uint16\""));
@@ -203,8 +202,8 @@
assertThat(yangList.isConfig(), is(true));
// Check whether leaf properties as set correctly.
- ListIterator<YangLeaf<?>> leafIterator = yangList.getListOfLeaf().listIterator();
- YangLeaf<?> leafInfo = leafIterator.next();
+ ListIterator<YangLeaf> leafIterator = yangList.getListOfLeaf().listIterator();
+ YangLeaf leafInfo = leafIterator.next();
assertThat(leafInfo.getLeafName(), is("invalid-interval"));
assertThat(leafInfo.getDataType().getDataTypeName(), is("\"uint16\""));
@@ -234,8 +233,8 @@
YangModule yangNode = (YangModule) node;
assertThat(yangNode.getName(), is("Test"));
- ListIterator<YangLeafList<?>> leafListIterator = yangNode.getListOfLeafList().listIterator();
- YangLeafList<?> leafListInfo = leafListIterator.next();
+ ListIterator<YangLeafList> leafListIterator = yangNode.getListOfLeafList().listIterator();
+ YangLeafList leafListInfo = leafListIterator.next();
// Check whether config value is set correctly.
assertThat(leafListInfo.getLeafName(), is("invalid-interval"));
diff --git a/utils/yangutils/src/test/java/org/onosproject/yangutils/parser/impl/listeners/ContainerListenerTest.java b/utils/yangutils/src/test/java/org/onosproject/yangutils/parser/impl/listeners/ContainerListenerTest.java
index 957a90b..aa86c51 100644
--- a/utils/yangutils/src/test/java/org/onosproject/yangutils/parser/impl/listeners/ContainerListenerTest.java
+++ b/utils/yangutils/src/test/java/org/onosproject/yangutils/parser/impl/listeners/ContainerListenerTest.java
@@ -16,24 +16,23 @@
package org.onosproject.yangutils.parser.impl.listeners;
+import java.io.IOException;
+import java.util.ListIterator;
+
import org.junit.Rule;
import org.junit.Test;
-
import org.junit.rules.ExpectedException;
+import org.onosproject.yangutils.datamodel.YangContainer;
+import org.onosproject.yangutils.datamodel.YangDataTypes;
import org.onosproject.yangutils.datamodel.YangLeaf;
+import org.onosproject.yangutils.datamodel.YangList;
import org.onosproject.yangutils.datamodel.YangModule;
import org.onosproject.yangutils.datamodel.YangNode;
import org.onosproject.yangutils.datamodel.YangNodeType;
-import org.onosproject.yangutils.datamodel.YangDataTypes;
import org.onosproject.yangutils.datamodel.YangStatusType;
-import org.onosproject.yangutils.datamodel.YangContainer;
-import org.onosproject.yangutils.datamodel.YangList;
import org.onosproject.yangutils.parser.exceptions.ParserException;
import org.onosproject.yangutils.parser.impl.YangUtilsParserManager;
-import java.io.IOException;
-import java.util.ListIterator;
-
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.core.Is.is;
@@ -154,8 +153,8 @@
assertThat(yangContainer.getReference(), is("\"container reference\""));
// Check whether leaf properties as set correctly.
- ListIterator<YangLeaf<?>> leafIterator = yangContainer.getListOfLeaf().listIterator();
- YangLeaf<?> leafInfo = leafIterator.next();
+ ListIterator<YangLeaf> leafIterator = yangContainer.getListOfLeaf().listIterator();
+ YangLeaf leafInfo = leafIterator.next();
assertThat(leafInfo.getLeafName(), is("invalid-interval"));
assertThat(leafInfo.getDataType().getDataTypeName(), is("\"uint16\""));
diff --git a/utils/yangutils/src/test/java/org/onosproject/yangutils/parser/impl/listeners/DescriptionListenerTest.java b/utils/yangutils/src/test/java/org/onosproject/yangutils/parser/impl/listeners/DescriptionListenerTest.java
index 74731d4..f3042bb 100644
--- a/utils/yangutils/src/test/java/org/onosproject/yangutils/parser/impl/listeners/DescriptionListenerTest.java
+++ b/utils/yangutils/src/test/java/org/onosproject/yangutils/parser/impl/listeners/DescriptionListenerTest.java
@@ -16,25 +16,24 @@
package org.onosproject.yangutils.parser.impl.listeners;
+import java.io.IOException;
+import java.util.ListIterator;
+
import org.junit.Rule;
import org.junit.Test;
-
import org.junit.rules.ExpectedException;
+import org.onosproject.yangutils.datamodel.YangContainer;
+import org.onosproject.yangutils.datamodel.YangDataTypes;
import org.onosproject.yangutils.datamodel.YangLeaf;
+import org.onosproject.yangutils.datamodel.YangLeafList;
+import org.onosproject.yangutils.datamodel.YangList;
import org.onosproject.yangutils.datamodel.YangModule;
import org.onosproject.yangutils.datamodel.YangNode;
import org.onosproject.yangutils.datamodel.YangNodeType;
-import org.onosproject.yangutils.datamodel.YangDataTypes;
import org.onosproject.yangutils.datamodel.YangStatusType;
-import org.onosproject.yangutils.datamodel.YangContainer;
-import org.onosproject.yangutils.datamodel.YangList;
-import org.onosproject.yangutils.datamodel.YangLeafList;
import org.onosproject.yangutils.parser.exceptions.ParserException;
import org.onosproject.yangutils.parser.impl.YangUtilsParserManager;
-import java.io.IOException;
-import java.util.ListIterator;
-
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.core.Is.is;
@@ -66,8 +65,8 @@
YangModule yangNode = (YangModule) node;
assertThat(yangNode.getName(), is("Test"));
- ListIterator<YangLeaf<?>> leafIterator = yangNode.getListOfLeaf().listIterator();
- YangLeaf<?> leafInfo = leafIterator.next();
+ ListIterator<YangLeaf> leafIterator = yangNode.getListOfLeaf().listIterator();
+ YangLeaf leafInfo = leafIterator.next();
// Check whether the description is set correctly.
assertThat(leafInfo.getLeafName(), is("invalid-interval"));
@@ -175,8 +174,8 @@
assertThat(container.getDescription(), is("\"container description\""));
// Check whether leaf properties as set correctly.
- ListIterator<YangLeaf<?>> leafIterator = container.getListOfLeaf().listIterator();
- YangLeaf<?> leafInfo = leafIterator.next();
+ ListIterator<YangLeaf> leafIterator = container.getListOfLeaf().listIterator();
+ YangLeaf leafInfo = leafIterator.next();
assertThat(leafInfo.getLeafName(), is("invalid-interval"));
assertThat(leafInfo.getDataType().getDataTypeName(), is("\"uint16\""));
@@ -212,8 +211,8 @@
assertThat(yangList.getDescription(), is("\"list description\""));
// Check whether leaf properties as set correctly.
- ListIterator<YangLeaf<?>> leafIterator = yangList.getListOfLeaf().listIterator();
- YangLeaf<?> leafInfo = leafIterator.next();
+ ListIterator<YangLeaf> leafIterator = yangList.getListOfLeaf().listIterator();
+ YangLeaf leafInfo = leafIterator.next();
assertThat(leafInfo.getLeafName(), is("invalid-interval"));
assertThat(leafInfo.getDataType().getDataTypeName(), is("\"uint16\""));
@@ -243,8 +242,8 @@
YangModule yangNode = (YangModule) node;
assertThat(yangNode.getName(), is("Test"));
- ListIterator<YangLeafList<?>> leafListIterator = yangNode.getListOfLeafList().listIterator();
- YangLeafList<?> leafListInfo = leafListIterator.next();
+ ListIterator<YangLeafList> leafListIterator = yangNode.getListOfLeafList().listIterator();
+ YangLeafList leafListInfo = leafListIterator.next();
// Check whether description value is set correctly.
assertThat(leafListInfo.getLeafName(), is("invalid-interval"));
diff --git a/utils/yangutils/src/test/java/org/onosproject/yangutils/parser/impl/listeners/LeafListListenerTest.java b/utils/yangutils/src/test/java/org/onosproject/yangutils/parser/impl/listeners/LeafListListenerTest.java
index e3f581b..359b108 100644
--- a/utils/yangutils/src/test/java/org/onosproject/yangutils/parser/impl/listeners/LeafListListenerTest.java
+++ b/utils/yangutils/src/test/java/org/onosproject/yangutils/parser/impl/listeners/LeafListListenerTest.java
@@ -16,24 +16,23 @@
package org.onosproject.yangutils.parser.impl.listeners;
+import java.io.IOException;
+import java.util.ListIterator;
+
import org.junit.Rule;
import org.junit.Test;
-
import org.junit.rules.ExpectedException;
+import org.onosproject.yangutils.datamodel.YangContainer;
+import org.onosproject.yangutils.datamodel.YangDataTypes;
import org.onosproject.yangutils.datamodel.YangLeafList;
+import org.onosproject.yangutils.datamodel.YangList;
import org.onosproject.yangutils.datamodel.YangModule;
import org.onosproject.yangutils.datamodel.YangNode;
import org.onosproject.yangutils.datamodel.YangNodeType;
-import org.onosproject.yangutils.datamodel.YangDataTypes;
import org.onosproject.yangutils.datamodel.YangStatusType;
-import org.onosproject.yangutils.datamodel.YangContainer;
-import org.onosproject.yangutils.datamodel.YangList;
import org.onosproject.yangutils.parser.exceptions.ParserException;
import org.onosproject.yangutils.parser.impl.YangUtilsParserManager;
-import java.io.IOException;
-import java.util.ListIterator;
-
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.core.Is.is;
@@ -48,8 +47,7 @@
private final YangUtilsParserManager manager = new YangUtilsParserManager();
/**
- * Checks all the values of leaf-list sub-statements are set
- * correctly.
+ * Checks all the values of leaf-list sub-statements are set correctly.
*/
@Test
public void processLeafListSubStatements() throws IOException, ParserException {
@@ -66,8 +64,8 @@
YangModule yangNode = (YangModule) node;
assertThat(yangNode.getName(), is("Test"));
- ListIterator<YangLeafList<?>> leafListIterator = yangNode.getListOfLeafList().listIterator();
- YangLeafList<?> leafListInfo = leafListIterator.next();
+ ListIterator<YangLeafList> leafListIterator = yangNode.getListOfLeafList().listIterator();
+ YangLeafList leafListInfo = leafListIterator.next();
assertThat(leafListInfo.getLeafName(), is("invalid-interval"));
assertThat(leafListInfo.getDataType().getDataTypeName(), is("\"uint16\""));
@@ -81,8 +79,8 @@
}
/**
- * Checks whether exception is thrown when leaf-list identifier
- * starts with digit.
+ * Checks whether exception is thrown when leaf-list identifier starts with
+ * digit.
*/
@Test
public void processLeafListInvalidIdentifier() throws IOException, ParserException {
@@ -92,8 +90,7 @@
}
/**
- * Checks whether exception is thrown when leaf-list keyword
- * is incorrect.
+ * Checks whether exception is thrown when leaf-list keyword is incorrect.
*/
@Test
public void processLeafListInvalidStatement() throws IOException, ParserException {
@@ -106,8 +103,8 @@
}
/**
- * Checks whether exception is thrown when leaf-list keyword
- * without Left brace as per grammar.
+ * Checks whether exception is thrown when leaf-list keyword without Left
+ * brace as per grammar.
*/
@Test
public void processLeafListWithoutLeftBrace() throws IOException, ParserException {
@@ -117,8 +114,8 @@
}
/**
- * Checks whether exception is thrown when config statement
- * cardinality is not as per grammar.
+ * Checks whether exception is thrown when config statement cardinality is
+ * not as per grammar.
*/
@Test
public void processLeafListConfigInvalidCardinality() throws IOException, ParserException {
@@ -128,8 +125,8 @@
}
/**
- * Checks whether exception is thrown when units statement
- * cardinality is not as per grammar.
+ * Checks whether exception is thrown when units statement cardinality is
+ * not as per grammar.
*/
@Test
public void processLeafListUnitsInvalidCardinality() throws IOException, ParserException {
@@ -161,8 +158,8 @@
assertThat(container.getName(), is("valid"));
// Check whether leaf-list properties as set correctly.
- ListIterator<YangLeafList<?>> leafListIterator = container.getListOfLeafList().listIterator();
- YangLeafList<?> leafListInfo = leafListIterator.next();
+ ListIterator<YangLeafList> leafListIterator = container.getListOfLeafList().listIterator();
+ YangLeafList leafListInfo = leafListIterator.next();
assertThat(leafListInfo.getLeafName(), is("invalid-interval"));
assertThat(leafListInfo.getDataType().getDataTypeName(), is("\"uint16\""));
@@ -198,8 +195,8 @@
assertThat(yangList.getName(), is("valid"));
// Check whether leaf-list properties as set correctly.
- ListIterator<YangLeafList<?>> leafListIterator = yangList.getListOfLeafList().listIterator();
- YangLeafList<?> leafListInfo = leafListIterator.next();
+ ListIterator<YangLeafList> leafListIterator = yangList.getListOfLeafList().listIterator();
+ YangLeafList leafListInfo = leafListIterator.next();
assertThat(leafListInfo.getLeafName(), is("invalid-interval"));
assertThat(leafListInfo.getDataType().getDataTypeName(), is("\"uint16\""));
diff --git a/utils/yangutils/src/test/java/org/onosproject/yangutils/parser/impl/listeners/LeafListenerTest.java b/utils/yangutils/src/test/java/org/onosproject/yangutils/parser/impl/listeners/LeafListenerTest.java
index bfbbb49..df8f385 100644
--- a/utils/yangutils/src/test/java/org/onosproject/yangutils/parser/impl/listeners/LeafListenerTest.java
+++ b/utils/yangutils/src/test/java/org/onosproject/yangutils/parser/impl/listeners/LeafListenerTest.java
@@ -16,24 +16,23 @@
package org.onosproject.yangutils.parser.impl.listeners;
+import java.io.IOException;
+import java.util.ListIterator;
+
import org.junit.Rule;
import org.junit.Test;
-
import org.junit.rules.ExpectedException;
+import org.onosproject.yangutils.datamodel.YangContainer;
+import org.onosproject.yangutils.datamodel.YangDataTypes;
import org.onosproject.yangutils.datamodel.YangLeaf;
+import org.onosproject.yangutils.datamodel.YangList;
import org.onosproject.yangutils.datamodel.YangModule;
import org.onosproject.yangutils.datamodel.YangNode;
import org.onosproject.yangutils.datamodel.YangNodeType;
-import org.onosproject.yangutils.datamodel.YangDataTypes;
import org.onosproject.yangutils.datamodel.YangStatusType;
-import org.onosproject.yangutils.datamodel.YangContainer;
-import org.onosproject.yangutils.datamodel.YangList;
import org.onosproject.yangutils.parser.exceptions.ParserException;
import org.onosproject.yangutils.parser.impl.YangUtilsParserManager;
-import java.io.IOException;
-import java.util.ListIterator;
-
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.core.Is.is;
@@ -48,8 +47,7 @@
private final YangUtilsParserManager manager = new YangUtilsParserManager();
/**
- * Checks all the values of leaf sub-statements are set
- * correctly.
+ * Checks all the values of leaf sub-statements are set correctly.
*/
@Test
public void processLeafSubStatements() throws IOException, ParserException {
@@ -66,8 +64,8 @@
YangModule yangNode = (YangModule) node;
assertThat(yangNode.getName(), is("Test"));
- ListIterator<YangLeaf<?>> leafIterator = yangNode.getListOfLeaf().listIterator();
- YangLeaf<?> leafInfo = leafIterator.next();
+ ListIterator<YangLeaf> leafIterator = yangNode.getListOfLeaf().listIterator();
+ YangLeaf leafInfo = leafIterator.next();
assertThat(leafInfo.getLeafName(), is("invalid-interval"));
assertThat(leafInfo.getDataType().getDataTypeName(), is("\"uint16\""));
@@ -81,8 +79,8 @@
}
/**
- * Checks whether exception is thrown when leaf identifier
- * starts with digit.
+ * Checks whether exception is thrown when leaf identifier starts with
+ * digit.
*/
@Test
public void processLeafInvalidIdentifier() throws IOException, ParserException {
@@ -92,8 +90,7 @@
}
/**
- * Checks whether exception is thrown when leaf keyword
- * is incorrect.
+ * Checks whether exception is thrown when leaf keyword is incorrect.
*/
@Test
public void processLeafInvalidStatement() throws IOException, ParserException {
@@ -106,8 +103,8 @@
}
/**
- * Checks whether exception is thrown when leaf keyword
- * without Left brace as per grammar.
+ * Checks whether exception is thrown when leaf keyword without Left brace
+ * as per grammar.
*/
@Test
public void processLeafWithoutLeftBrace() throws IOException, ParserException {
@@ -117,8 +114,8 @@
}
/**
- * Checks whether exception is thrown when config statement
- * cardinality is not as per grammar.
+ * Checks whether exception is thrown when config statement cardinality is
+ * not as per grammar.
*/
@Test
public void processLeafConfigInvalidCardinality() throws IOException, ParserException {
@@ -128,8 +125,8 @@
}
/**
- * Checks whether exception is thrown when mandatory statement
- * cardinality is not as per grammar.
+ * Checks whether exception is thrown when mandatory statement cardinality
+ * is not as per grammar.
*/
@Test
public void processLeafMandatoryInvalidCardinality() throws IOException, ParserException {
@@ -161,8 +158,8 @@
assertThat(container.getName(), is("valid"));
// Check whether leaf properties as set correctly.
- ListIterator<YangLeaf<?>> leafIterator = container.getListOfLeaf().listIterator();
- YangLeaf<?> leafInfo = leafIterator.next();
+ ListIterator<YangLeaf> leafIterator = container.getListOfLeaf().listIterator();
+ YangLeaf leafInfo = leafIterator.next();
assertThat(leafInfo.getLeafName(), is("invalid-interval"));
assertThat(leafInfo.getDataType().getDataTypeName(), is("\"uint16\""));
@@ -197,8 +194,8 @@
assertThat(yangList.getName(), is("valid"));
// Check whether leaf properties as set correctly.
- ListIterator<YangLeaf<?>> leafIterator = yangList.getListOfLeaf().listIterator();
- YangLeaf<?> leafInfo = leafIterator.next();
+ ListIterator<YangLeaf> leafIterator = yangList.getListOfLeaf().listIterator();
+ YangLeaf leafInfo = leafIterator.next();
assertThat(leafInfo.getLeafName(), is("invalid-interval"));
assertThat(leafInfo.getDataType().getDataTypeName(), is("\"uint16\""));
diff --git a/utils/yangutils/src/test/java/org/onosproject/yangutils/parser/impl/listeners/ListListenerTest.java b/utils/yangutils/src/test/java/org/onosproject/yangutils/parser/impl/listeners/ListListenerTest.java
index 4f86754..f552387 100644
--- a/utils/yangutils/src/test/java/org/onosproject/yangutils/parser/impl/listeners/ListListenerTest.java
+++ b/utils/yangutils/src/test/java/org/onosproject/yangutils/parser/impl/listeners/ListListenerTest.java
@@ -16,24 +16,23 @@
package org.onosproject.yangutils.parser.impl.listeners;
+import java.io.IOException;
+import java.util.ListIterator;
+
import org.junit.Rule;
import org.junit.Test;
-
import org.junit.rules.ExpectedException;
+import org.onosproject.yangutils.datamodel.YangContainer;
+import org.onosproject.yangutils.datamodel.YangDataTypes;
import org.onosproject.yangutils.datamodel.YangLeaf;
+import org.onosproject.yangutils.datamodel.YangList;
import org.onosproject.yangutils.datamodel.YangModule;
import org.onosproject.yangutils.datamodel.YangNode;
import org.onosproject.yangutils.datamodel.YangNodeType;
-import org.onosproject.yangutils.datamodel.YangDataTypes;
import org.onosproject.yangutils.datamodel.YangStatusType;
-import org.onosproject.yangutils.datamodel.YangContainer;
-import org.onosproject.yangutils.datamodel.YangList;
import org.onosproject.yangutils.parser.exceptions.ParserException;
import org.onosproject.yangutils.parser.impl.YangUtilsParserManager;
-import java.io.IOException;
-import java.util.ListIterator;
-
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.core.Is.is;
@@ -159,8 +158,8 @@
assertThat(yangList.getReference(), is("\"list reference\""));
// Check whether leaf properties as set correctly.
- ListIterator<YangLeaf<?>> leafIterator = yangList.getListOfLeaf().listIterator();
- YangLeaf<?> leafInfo = leafIterator.next();
+ ListIterator<YangLeaf> leafIterator = yangList.getListOfLeaf().listIterator();
+ YangLeaf leafInfo = leafIterator.next();
assertThat(leafInfo.getLeafName(), is("invalid-interval"));
assertThat(leafInfo.getDataType().getDataTypeName(), is("\"uint16\""));
diff --git a/utils/yangutils/src/test/java/org/onosproject/yangutils/parser/impl/listeners/MandatoryListenerTest.java b/utils/yangutils/src/test/java/org/onosproject/yangutils/parser/impl/listeners/MandatoryListenerTest.java
index 7797de6..c30dee5 100644
--- a/utils/yangutils/src/test/java/org/onosproject/yangutils/parser/impl/listeners/MandatoryListenerTest.java
+++ b/utils/yangutils/src/test/java/org/onosproject/yangutils/parser/impl/listeners/MandatoryListenerTest.java
@@ -16,19 +16,19 @@
package org.onosproject.yangutils.parser.impl.listeners;
+import java.io.IOException;
+import java.util.ListIterator;
+
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;
+import org.onosproject.yangutils.datamodel.YangLeaf;
+import org.onosproject.yangutils.datamodel.YangModule;
import org.onosproject.yangutils.datamodel.YangNode;
import org.onosproject.yangutils.datamodel.YangNodeType;
-import org.onosproject.yangutils.datamodel.YangModule;
-import org.onosproject.yangutils.datamodel.YangLeaf;
import org.onosproject.yangutils.parser.exceptions.ParserException;
import org.onosproject.yangutils.parser.impl.YangUtilsParserManager;
-import java.io.IOException;
-import java.util.ListIterator;
-
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.core.Is.is;
@@ -60,8 +60,8 @@
YangModule yangNode = (YangModule) node;
assertThat(yangNode.getName(), is("Test"));
- ListIterator<YangLeaf<?>> leafIterator = yangNode.getListOfLeaf().listIterator();
- YangLeaf<?> leafInfo = leafIterator.next();
+ ListIterator<YangLeaf> leafIterator = yangNode.getListOfLeaf().listIterator();
+ YangLeaf leafInfo = leafIterator.next();
// Check whether the mandatory value is set correctly.
assertThat(leafInfo.getLeafName(), is("invalid-interval"));
@@ -86,8 +86,8 @@
YangModule yangNode = (YangModule) node;
assertThat(yangNode.getName(), is("Test"));
- ListIterator<YangLeaf<?>> leafIterator = yangNode.getListOfLeaf().listIterator();
- YangLeaf<?> leafInfo = leafIterator.next();
+ ListIterator<YangLeaf> leafIterator = yangNode.getListOfLeaf().listIterator();
+ YangLeaf leafInfo = leafIterator.next();
// Check whether the mandatory value is set correctly.
assertThat(leafInfo.getLeafName(), is("invalid-interval"));
@@ -112,8 +112,8 @@
YangModule yangNode = (YangModule) node;
assertThat(yangNode.getName(), is("Test"));
- ListIterator<YangLeaf<?>> leafIterator = yangNode.getListOfLeaf().listIterator();
- YangLeaf<?> leafInfo = leafIterator.next();
+ ListIterator<YangLeaf> leafIterator = yangNode.getListOfLeaf().listIterator();
+ YangLeaf leafInfo = leafIterator.next();
// Check whether the mandatory value is set correctly.
assertThat(leafInfo.getLeafName(), is("invalid-interval"));
@@ -131,7 +131,8 @@
}
/**
- * Checks invalid mandatory statement(without statement end) and expects exception.
+ * Checks invalid mandatory statement(without statement end) and expects
+ * exception.
*/
@Test
public void processMandatoryWithoutStatementEnd() throws IOException, ParserException {
@@ -141,7 +142,8 @@
}
/**
- * Checks mandatory statement as sub-statement of module and expects exception.
+ * Checks mandatory statement as sub-statement of module and expects
+ * exception.
*/
@Test
public void processModuleSubStatementMandatory() throws IOException, ParserException {
diff --git a/utils/yangutils/src/test/java/org/onosproject/yangutils/parser/impl/listeners/MaxElementsListenerTest.java b/utils/yangutils/src/test/java/org/onosproject/yangutils/parser/impl/listeners/MaxElementsListenerTest.java
index 11a973b..b9f12b0 100644
--- a/utils/yangutils/src/test/java/org/onosproject/yangutils/parser/impl/listeners/MaxElementsListenerTest.java
+++ b/utils/yangutils/src/test/java/org/onosproject/yangutils/parser/impl/listeners/MaxElementsListenerTest.java
@@ -16,21 +16,20 @@
package org.onosproject.yangutils.parser.impl.listeners;
+import java.io.IOException;
+import java.util.ListIterator;
+
import org.junit.Rule;
import org.junit.Test;
-
import org.junit.rules.ExpectedException;
import org.onosproject.yangutils.datamodel.YangLeafList;
+import org.onosproject.yangutils.datamodel.YangList;
import org.onosproject.yangutils.datamodel.YangModule;
import org.onosproject.yangutils.datamodel.YangNode;
import org.onosproject.yangutils.datamodel.YangNodeType;
-import org.onosproject.yangutils.datamodel.YangList;
import org.onosproject.yangutils.parser.exceptions.ParserException;
import org.onosproject.yangutils.parser.impl.YangUtilsParserManager;
-import java.io.IOException;
-import java.util.ListIterator;
-
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.core.Is.is;
@@ -62,8 +61,8 @@
YangModule yangNode = (YangModule) node;
assertThat(yangNode.getName(), is("Test"));
- ListIterator<YangLeafList<?>> leafListIterator = yangNode.getListOfLeafList().listIterator();
- YangLeafList<?> leafListInfo = leafListIterator.next();
+ ListIterator<YangLeafList> leafListIterator = yangNode.getListOfLeafList().listIterator();
+ YangLeafList leafListInfo = leafListIterator.next();
assertThat(leafListInfo.getLeafName(), is("invalid-interval"));
assertThat(leafListInfo.getMaxElelements(), is(3));
@@ -93,8 +92,8 @@
}
/**
- * Checks whether exception is thrown when invalid max-elements keyword
- * is given as input.
+ * Checks whether exception is thrown when invalid max-elements keyword is
+ * given as input.
*/
@Test
public void processMaxElementsInvalidStatement() throws IOException, ParserException {
@@ -106,8 +105,8 @@
}
/**
- * Checks whether exception is thrown when max-elements statement without statement
- * end is given as input.
+ * Checks whether exception is thrown when max-elements statement without
+ * statement end is given as input.
*/
@Test
public void processMaxElementsWithoutStatementEnd() throws IOException, ParserException {
@@ -145,8 +144,8 @@
YangModule yangNode = (YangModule) node;
assertThat(yangNode.getName(), is("Test"));
- ListIterator<YangLeafList<?>> leafListIterator = yangNode.getListOfLeafList().listIterator();
- YangLeafList<?> leafListInfo = leafListIterator.next();
+ ListIterator<YangLeafList> leafListIterator = yangNode.getListOfLeafList().listIterator();
+ YangLeafList leafListInfo = leafListIterator.next();
assertThat(leafListInfo.getLeafName(), is("invalid-interval"));
assertThat(leafListInfo.getMaxElelements(), is(2147483647));
diff --git a/utils/yangutils/src/test/java/org/onosproject/yangutils/parser/impl/listeners/MinElementsListenerTest.java b/utils/yangutils/src/test/java/org/onosproject/yangutils/parser/impl/listeners/MinElementsListenerTest.java
index 2251082..a5dca38 100644
--- a/utils/yangutils/src/test/java/org/onosproject/yangutils/parser/impl/listeners/MinElementsListenerTest.java
+++ b/utils/yangutils/src/test/java/org/onosproject/yangutils/parser/impl/listeners/MinElementsListenerTest.java
@@ -16,21 +16,20 @@
package org.onosproject.yangutils.parser.impl.listeners;
+import java.io.IOException;
+import java.util.ListIterator;
+
import org.junit.Rule;
import org.junit.Test;
-
import org.junit.rules.ExpectedException;
import org.onosproject.yangutils.datamodel.YangLeafList;
+import org.onosproject.yangutils.datamodel.YangList;
import org.onosproject.yangutils.datamodel.YangModule;
import org.onosproject.yangutils.datamodel.YangNode;
import org.onosproject.yangutils.datamodel.YangNodeType;
-import org.onosproject.yangutils.datamodel.YangList;
import org.onosproject.yangutils.parser.exceptions.ParserException;
import org.onosproject.yangutils.parser.impl.YangUtilsParserManager;
-import java.io.IOException;
-import java.util.ListIterator;
-
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.core.Is.is;
@@ -62,8 +61,8 @@
YangModule yangNode = (YangModule) node;
assertThat(yangNode.getName(), is("Test"));
- ListIterator<YangLeafList<?>> leafListIterator = yangNode.getListOfLeafList().listIterator();
- YangLeafList<?> leafListInfo = leafListIterator.next();
+ ListIterator<YangLeafList> leafListIterator = yangNode.getListOfLeafList().listIterator();
+ YangLeafList leafListInfo = leafListIterator.next();
assertThat(leafListInfo.getLeafName(), is("invalid-interval"));
assertThat(leafListInfo.getMinElements(), is(3));
@@ -93,8 +92,8 @@
}
/**
- * Checks whether exception is thrown when invalid min-elements keyword
- * is given as input.
+ * Checks whether exception is thrown when invalid min-elements keyword is
+ * given as input.
*/
@Test
public void processMinElementsInvalidKeyword() throws IOException, ParserException {
@@ -106,8 +105,8 @@
}
/**
- * Checks whether exception is thrown when invalid min-elements value
- * is given as input.
+ * Checks whether exception is thrown when invalid min-elements value is
+ * given as input.
*/
@Test
public void processMinElementsInvalidValue() throws IOException, ParserException {
@@ -117,8 +116,8 @@
}
/**
- * Checks whether exception is thrown when min-elements statement without statement
- * end is given as input.
+ * Checks whether exception is thrown when min-elements statement without
+ * statement end is given as input.
*/
@Test
public void processMinElementsWithoutStatementEnd() throws IOException, ParserException {
diff --git a/utils/yangutils/src/test/java/org/onosproject/yangutils/parser/impl/listeners/ReferenceListenerTest.java b/utils/yangutils/src/test/java/org/onosproject/yangutils/parser/impl/listeners/ReferenceListenerTest.java
index 28ab2c2..c398569 100644
--- a/utils/yangutils/src/test/java/org/onosproject/yangutils/parser/impl/listeners/ReferenceListenerTest.java
+++ b/utils/yangutils/src/test/java/org/onosproject/yangutils/parser/impl/listeners/ReferenceListenerTest.java
@@ -16,25 +16,24 @@
package org.onosproject.yangutils.parser.impl.listeners;
+import java.io.IOException;
+import java.util.ListIterator;
+
import org.junit.Rule;
import org.junit.Test;
-
import org.junit.rules.ExpectedException;
+import org.onosproject.yangutils.datamodel.YangContainer;
+import org.onosproject.yangutils.datamodel.YangDataTypes;
import org.onosproject.yangutils.datamodel.YangLeaf;
+import org.onosproject.yangutils.datamodel.YangLeafList;
+import org.onosproject.yangutils.datamodel.YangList;
import org.onosproject.yangutils.datamodel.YangModule;
import org.onosproject.yangutils.datamodel.YangNode;
import org.onosproject.yangutils.datamodel.YangNodeType;
-import org.onosproject.yangutils.datamodel.YangDataTypes;
import org.onosproject.yangutils.datamodel.YangStatusType;
-import org.onosproject.yangutils.datamodel.YangContainer;
-import org.onosproject.yangutils.datamodel.YangList;
-import org.onosproject.yangutils.datamodel.YangLeafList;
import org.onosproject.yangutils.parser.exceptions.ParserException;
import org.onosproject.yangutils.parser.impl.YangUtilsParserManager;
-import java.io.IOException;
-import java.util.ListIterator;
-
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.core.Is.is;
@@ -66,8 +65,8 @@
YangModule yangNode = (YangModule) node;
assertThat(yangNode.getName(), is("Test"));
- ListIterator<YangLeaf<?>> leafIterator = yangNode.getListOfLeaf().listIterator();
- YangLeaf<?> leafInfo = leafIterator.next();
+ ListIterator<YangLeaf> leafIterator = yangNode.getListOfLeaf().listIterator();
+ YangLeaf leafInfo = leafIterator.next();
// Check whether the reference is set correctly.
assertThat(leafInfo.getLeafName(), is("invalid-interval"));
@@ -174,8 +173,8 @@
assertThat(container.getReference(), is("\"container reference\""));
// Check whether leaf properties as set correctly.
- ListIterator<YangLeaf<?>> leafIterator = container.getListOfLeaf().listIterator();
- YangLeaf<?> leafInfo = leafIterator.next();
+ ListIterator<YangLeaf> leafIterator = container.getListOfLeaf().listIterator();
+ YangLeaf leafInfo = leafIterator.next();
assertThat(leafInfo.getLeafName(), is("invalid-interval"));
assertThat(leafInfo.getDataType().getDataTypeName(), is("\"uint16\""));
@@ -211,8 +210,8 @@
assertThat(yangList.getReference(), is("\"list reference\""));
// Check whether leaf properties as set correctly.
- ListIterator<YangLeaf<?>> leafIterator = yangList.getListOfLeaf().listIterator();
- YangLeaf<?> leafInfo = leafIterator.next();
+ ListIterator<YangLeaf> leafIterator = yangList.getListOfLeaf().listIterator();
+ YangLeaf leafInfo = leafIterator.next();
assertThat(leafInfo.getLeafName(), is("invalid-interval"));
assertThat(leafInfo.getDataType().getDataTypeName(), is("\"uint16\""));
@@ -242,8 +241,8 @@
YangModule yangNode = (YangModule) node;
assertThat(yangNode.getName(), is("Test"));
- ListIterator<YangLeafList<?>> leafListIterator = yangNode.getListOfLeafList().listIterator();
- YangLeafList<?> leafListInfo = leafListIterator.next();
+ ListIterator<YangLeafList> leafListIterator = yangNode.getListOfLeafList().listIterator();
+ YangLeafList leafListInfo = leafListIterator.next();
// Check whether description value is set correctly.
assertThat(leafListInfo.getLeafName(), is("invalid-interval"));
diff --git a/utils/yangutils/src/test/java/org/onosproject/yangutils/parser/impl/listeners/StatusListenerTest.java b/utils/yangutils/src/test/java/org/onosproject/yangutils/parser/impl/listeners/StatusListenerTest.java
index 7b4c543..ddd98d0 100644
--- a/utils/yangutils/src/test/java/org/onosproject/yangutils/parser/impl/listeners/StatusListenerTest.java
+++ b/utils/yangutils/src/test/java/org/onosproject/yangutils/parser/impl/listeners/StatusListenerTest.java
@@ -16,25 +16,24 @@
package org.onosproject.yangutils.parser.impl.listeners;
+import java.io.IOException;
+import java.util.ListIterator;
+
import org.junit.Rule;
import org.junit.Test;
-
import org.junit.rules.ExpectedException;
+import org.onosproject.yangutils.datamodel.YangContainer;
+import org.onosproject.yangutils.datamodel.YangDataTypes;
import org.onosproject.yangutils.datamodel.YangLeaf;
+import org.onosproject.yangutils.datamodel.YangLeafList;
+import org.onosproject.yangutils.datamodel.YangList;
import org.onosproject.yangutils.datamodel.YangModule;
import org.onosproject.yangutils.datamodel.YangNode;
import org.onosproject.yangutils.datamodel.YangNodeType;
-import org.onosproject.yangutils.datamodel.YangDataTypes;
import org.onosproject.yangutils.datamodel.YangStatusType;
-import org.onosproject.yangutils.datamodel.YangContainer;
-import org.onosproject.yangutils.datamodel.YangList;
-import org.onosproject.yangutils.datamodel.YangLeafList;
import org.onosproject.yangutils.parser.exceptions.ParserException;
import org.onosproject.yangutils.parser.impl.YangUtilsParserManager;
-import java.io.IOException;
-import java.util.ListIterator;
-
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.core.Is.is;
@@ -66,8 +65,8 @@
YangModule yangNode = (YangModule) node;
assertThat(yangNode.getName(), is("Test"));
- ListIterator<YangLeaf<?>> leafIterator = yangNode.getListOfLeaf().listIterator();
- YangLeaf<?> leafInfo = leafIterator.next();
+ ListIterator<YangLeaf> leafIterator = yangNode.getListOfLeaf().listIterator();
+ YangLeaf leafInfo = leafIterator.next();
// Check whether the status is set correctly.
assertThat(leafInfo.getLeafName(), is("invalid-interval"));
@@ -92,8 +91,8 @@
YangModule yangNode = (YangModule) node;
assertThat(yangNode.getName(), is("Test"));
- ListIterator<YangLeaf<?>> leafIterator = yangNode.getListOfLeaf().listIterator();
- YangLeaf<?> leafInfo = leafIterator.next();
+ ListIterator<YangLeaf> leafIterator = yangNode.getListOfLeaf().listIterator();
+ YangLeaf leafInfo = leafIterator.next();
// Check whether the status is set correctly.
assertThat(leafInfo.getLeafName(), is("invalid-interval"));
@@ -118,8 +117,8 @@
YangModule yangNode = (YangModule) node;
assertThat(yangNode.getName(), is("Test"));
- ListIterator<YangLeaf<?>> leafIterator = yangNode.getListOfLeaf().listIterator();
- YangLeaf<?> leafInfo = leafIterator.next();
+ ListIterator<YangLeaf> leafIterator = yangNode.getListOfLeaf().listIterator();
+ YangLeaf leafInfo = leafIterator.next();
// Check whether the status is set correctly.
assertThat(leafInfo.getLeafName(), is("invalid-interval"));
@@ -184,8 +183,8 @@
assertThat(container.getStatus(), is(YangStatusType.OBSOLETE));
// Check whether leaf properties as set correctly.
- ListIterator<YangLeaf<?>> leafIterator = container.getListOfLeaf().listIterator();
- YangLeaf<?> leafInfo = leafIterator.next();
+ ListIterator<YangLeaf> leafIterator = container.getListOfLeaf().listIterator();
+ YangLeaf leafInfo = leafIterator.next();
assertThat(leafInfo.getLeafName(), is("invalid-interval"));
assertThat(leafInfo.getDataType().getDataTypeName(), is("\"uint16\""));
@@ -221,8 +220,8 @@
assertThat(yangList.getStatus(), is(YangStatusType.CURRENT));
// Check whether leaf properties as set correctly.
- ListIterator<YangLeaf<?>> leafIterator = yangList.getListOfLeaf().listIterator();
- YangLeaf<?> leafInfo = leafIterator.next();
+ ListIterator<YangLeaf> leafIterator = yangList.getListOfLeaf().listIterator();
+ YangLeaf leafInfo = leafIterator.next();
assertThat(leafInfo.getLeafName(), is("invalid-interval"));
assertThat(leafInfo.getDataType().getDataTypeName(), is("\"uint16\""));
@@ -252,8 +251,8 @@
YangModule yangNode = (YangModule) node;
assertThat(yangNode.getName(), is("Test"));
- ListIterator<YangLeafList<?>> leafListIterator = yangNode.getListOfLeafList().listIterator();
- YangLeafList<?> leafListInfo = leafListIterator.next();
+ ListIterator<YangLeafList> leafListIterator = yangNode.getListOfLeafList().listIterator();
+ YangLeafList leafListInfo = leafListIterator.next();
// Check whether status is set correctly.
assertThat(leafListInfo.getLeafName(), is("invalid-interval"));
diff --git a/utils/yangutils/src/test/java/org/onosproject/yangutils/parser/impl/listeners/TypeListenerTest.java b/utils/yangutils/src/test/java/org/onosproject/yangutils/parser/impl/listeners/TypeListenerTest.java
index 42332b7..a1146aa 100644
--- a/utils/yangutils/src/test/java/org/onosproject/yangutils/parser/impl/listeners/TypeListenerTest.java
+++ b/utils/yangutils/src/test/java/org/onosproject/yangutils/parser/impl/listeners/TypeListenerTest.java
@@ -1,18 +1,18 @@
package org.onosproject.yangutils.parser.impl.listeners;
+import java.io.IOException;
+import java.util.ListIterator;
+
import org.junit.Test;
+import org.onosproject.yangutils.datamodel.YangDataTypes;
import org.onosproject.yangutils.datamodel.YangLeaf;
+import org.onosproject.yangutils.datamodel.YangLeafList;
import org.onosproject.yangutils.datamodel.YangModule;
import org.onosproject.yangutils.datamodel.YangNode;
import org.onosproject.yangutils.datamodel.YangNodeType;
-import org.onosproject.yangutils.datamodel.YangDataTypes;
-import org.onosproject.yangutils.datamodel.YangLeafList;
import org.onosproject.yangutils.parser.exceptions.ParserException;
import org.onosproject.yangutils.parser.impl.YangUtilsParserManager;
-import java.io.IOException;
-import java.util.ListIterator;
-
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.core.Is.is;
@@ -41,8 +41,8 @@
YangModule yangNode = (YangModule) node;
assertThat(yangNode.getName(), is("Test"));
- ListIterator<YangLeaf<?>> leafIterator = yangNode.getListOfLeaf().listIterator();
- YangLeaf<?> leafInfo = leafIterator.next();
+ ListIterator<YangLeaf> leafIterator = yangNode.getListOfLeaf().listIterator();
+ YangLeaf leafInfo = leafIterator.next();
assertThat(leafInfo.getLeafName(), is("invalid-interval"));
assertThat(leafInfo.getDataType().getDataTypeName(), is("\"hello\""));
@@ -67,8 +67,8 @@
YangModule yangNode = (YangModule) node;
assertThat(yangNode.getName(), is("Test"));
- ListIterator<YangLeaf<?>> leafIterator = yangNode.getListOfLeaf().listIterator();
- YangLeaf<?> leafInfo = leafIterator.next();
+ ListIterator<YangLeaf> leafIterator = yangNode.getListOfLeaf().listIterator();
+ YangLeaf leafInfo = leafIterator.next();
assertThat(leafInfo.getLeafName(), is("invalid-interval"));
assertThat(leafInfo.getDataType().getDataTypeName(), is("\"uint16\""));
@@ -93,8 +93,8 @@
YangModule yangNode = (YangModule) node;
assertThat(yangNode.getName(), is("Test"));
- ListIterator<YangLeafList<?>> leafListIterator = yangNode.getListOfLeafList().listIterator();
- YangLeafList<?> leafListInfo = leafListIterator.next();
+ ListIterator<YangLeafList> leafListIterator = yangNode.getListOfLeafList().listIterator();
+ YangLeafList leafListInfo = leafListIterator.next();
assertThat(leafListInfo.getLeafName(), is("invalid-interval"));
assertThat(leafListInfo.getDataType().getDataTypeName(), is("\"uint16\""));
diff --git a/utils/yangutils/src/test/java/org/onosproject/yangutils/parser/impl/listeners/UnitsListenerTest.java b/utils/yangutils/src/test/java/org/onosproject/yangutils/parser/impl/listeners/UnitsListenerTest.java
index c89138b..c4b9fa7 100644
--- a/utils/yangutils/src/test/java/org/onosproject/yangutils/parser/impl/listeners/UnitsListenerTest.java
+++ b/utils/yangutils/src/test/java/org/onosproject/yangutils/parser/impl/listeners/UnitsListenerTest.java
@@ -16,25 +16,24 @@
package org.onosproject.yangutils.parser.impl.listeners;
+import java.io.IOException;
+import java.util.ListIterator;
+
import org.junit.Rule;
import org.junit.Test;
-
import org.junit.rules.ExpectedException;
import org.onosproject.yangutils.datamodel.YangLeaf;
+import org.onosproject.yangutils.datamodel.YangLeafList;
import org.onosproject.yangutils.datamodel.YangModule;
import org.onosproject.yangutils.datamodel.YangNode;
import org.onosproject.yangutils.datamodel.YangNodeType;
import org.onosproject.yangutils.datamodel.YangStatusType;
-import org.onosproject.yangutils.datamodel.YangLeafList;
import org.onosproject.yangutils.parser.exceptions.ParserException;
import org.onosproject.yangutils.parser.impl.YangUtilsParserManager;
-import java.io.IOException;
-import java.util.ListIterator;
-
import static org.hamcrest.MatcherAssert.assertThat;
-import static org.hamcrest.core.Is.is;
import static org.hamcrest.Matchers.nullValue;
+import static org.hamcrest.core.Is.is;
/**
* Test cases for units listener.
@@ -64,8 +63,8 @@
YangModule yangNode = (YangModule) node;
assertThat(yangNode.getName(), is("Test"));
- ListIterator<YangLeaf<?>> leafIterator = yangNode.getListOfLeaf().listIterator();
- YangLeaf<?> leafInfo = leafIterator.next();
+ ListIterator<YangLeaf> leafIterator = yangNode.getListOfLeaf().listIterator();
+ YangLeaf leafInfo = leafIterator.next();
// Check whether units value is set correctly.
assertThat(leafInfo.getLeafName(), is("invalid-interval"));
@@ -113,8 +112,8 @@
YangModule yangNode = (YangModule) node;
assertThat(yangNode.getName(), is("Test"));
- ListIterator<YangLeaf<?>> leafIterator = yangNode.getListOfLeaf().listIterator();
- YangLeaf<?> leafInfo = leafIterator.next();
+ ListIterator<YangLeaf> leafIterator = yangNode.getListOfLeaf().listIterator();
+ YangLeaf leafInfo = leafIterator.next();
// Check whether leaf properties is set correctly.
assertThat(leafInfo.getLeafName(), is("invalid-interval"));
@@ -145,8 +144,8 @@
YangModule yangNode = (YangModule) node;
assertThat(yangNode.getName(), is("Test"));
- ListIterator<YangLeaf<?>> leafIterator = yangNode.getListOfLeaf().listIterator();
- YangLeaf<?> leafInfo = leafIterator.next();
+ ListIterator<YangLeaf> leafIterator = yangNode.getListOfLeaf().listIterator();
+ YangLeaf leafInfo = leafIterator.next();
assertThat(leafInfo.getLeafName(), is("invalid-interval"));
assertThat(leafInfo.getUnits(), is(nullValue()));
@@ -180,8 +179,8 @@
YangModule yangNode = (YangModule) node;
assertThat(yangNode.getName(), is("Test"));
- ListIterator<YangLeafList<?>> leafListIterator = yangNode.getListOfLeafList().listIterator();
- YangLeafList<?> leafListInfo = leafListIterator.next();
+ ListIterator<YangLeafList> leafListIterator = yangNode.getListOfLeafList().listIterator();
+ YangLeafList leafListInfo = leafListIterator.next();
// Check whether units value is set correctly.
assertThat(leafListInfo.getLeafName(), is("invalid-interval"));