Merge "Elaborating ModelConverter API javadoc"
diff --git a/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangSchemaNode.java b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangSchemaNode.java
index 5287bcb..8a83ff8 100644
--- a/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangSchemaNode.java
+++ b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/YangSchemaNode.java
@@ -16,12 +16,11 @@
package org.onosproject.yang.compiler.datamodel;
+import java.util.Map;
import org.onosproject.yang.compiler.datamodel.exceptions.DataModelException;
import org.onosproject.yang.model.SchemaContext;
import org.onosproject.yang.model.YangNamespace;
-import java.util.Map;
-
/**
* Abstraction of YANG data node, used by YMS to abstractly refer the data
* nodes in YANG data tree.
@@ -44,7 +43,7 @@
* @throws DataModelException data model exception in searching the child
*/
YangSchemaNodeContextInfo getChildSchema(YangSchemaNodeIdentifier dataNodeIdentifier)
- throws DataModelException;
+ throws DataModelException;
/**
* Validates whether the leaf/leaf-list value is valid as per YANG. It is
@@ -54,7 +53,7 @@
* @throws DataModelException a violation in data model rule
*/
void isValueValid(String value)
- throws DataModelException;
+ throws DataModelException;
/**
* Returns count of mandatory child nodes, this is used by YMS to identify
@@ -64,7 +63,7 @@
* @throws DataModelException a violation in data model rule
*/
int getMandatoryChildCount()
- throws DataModelException;
+ throws DataModelException;
/**
* Returns map of default child nodes, this is used by YMS to identify
@@ -75,7 +74,7 @@
* @return map of default child nodes
*/
Map<YangSchemaNodeIdentifier, YangSchemaNode> getDefaultChild(
- YangSchemaNodeIdentifier dataNodeIdentifier);
+ YangSchemaNodeIdentifier dataNodeIdentifier);
/**
* Get Java class's package corresponding to the schema node.
@@ -128,7 +127,7 @@
* @throws DataModelException a violation in data model rule
*/
boolean isNotificationPresent()
- throws DataModelException;
+ throws DataModelException;
/**
* Checks for the presence of rpc in module/sub-module. Exception
@@ -149,7 +148,7 @@
* @throws DataModelException a violation in data model rule
*/
YangSchemaNode getNotificationSchemaNode(String notificationNameInEnum)
- throws DataModelException;
+ throws DataModelException;
/**
* Returns referred schema node in case of grouping.
@@ -165,7 +164,9 @@
*
* @return true if empty data-type is present, false otherwise
* @throws DataModelException when fails to do data model operations
+ * @deprecated use LeafSchemaContext getLeafType() instead
*/
+ @Deprecated
boolean isEmptyDataType() throws DataModelException;
/**
@@ -190,5 +191,5 @@
* @throws IllegalArgumentException when fails to do data model operations
*/
YangSchemaNode addSchema(YangSchemaNode containedSchema)
- throws IllegalArgumentException;
+ throws IllegalArgumentException;
}
diff --git a/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/utils/DataModelUtils.java b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/utils/DataModelUtils.java
index 2640a8b..b91af76 100644
--- a/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/utils/DataModelUtils.java
+++ b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/utils/DataModelUtils.java
@@ -916,7 +916,9 @@
*
* @param dataType the data type
* @return true, for empty resolved data-type; false otherwise
+ * @deprecated use LeafContextUtil.getLeafType instead
*/
+ @Deprecated
public static boolean validateEmptyDataType(YangType dataType) {
switch (dataType.getDataType()) {
case DERIVED:
@@ -936,6 +938,7 @@
case UNION:
return ((YangUnion) dataType.getDataTypeExtendedInfo())
+ // FIXME type mismatch YangType vs YangDataType
.getTypeList().contains(EMPTY);
default:
return dataType.getDataType().equals(EMPTY);
@@ -1381,7 +1384,7 @@
holder.addUniqueLeaf(leaf);
}
List<YangLeaf> leaves = holder.getUniqueLeaves();
- Map<YangLeaf, Integer> map = new HashMap<YangLeaf, Integer>();
+ Map<YangLeaf, Integer> map = new HashMap<>();
for (YangLeaf lf : leaves) {
if (map.containsKey(lf)) {
throw new DataModelException(E_UNIQUE);
diff --git a/compiler/base/translator/src/main/java/org/onosproject/yang/compiler/translator/tojava/utils/MethodsGenerator.java b/compiler/base/translator/src/main/java/org/onosproject/yang/compiler/translator/tojava/utils/MethodsGenerator.java
index ba3e947..a8b9bac 100644
--- a/compiler/base/translator/src/main/java/org/onosproject/yang/compiler/translator/tojava/utils/MethodsGenerator.java
+++ b/compiler/base/translator/src/main/java/org/onosproject/yang/compiler/translator/tojava/utils/MethodsGenerator.java
@@ -870,6 +870,7 @@
StringBuilder builder = new StringBuilder(getOverRideString());
builder.append(methodSignature(HASH_CODE_STRING, EMPTY_STRING, PUBLIC,
null, INT, null, CLASS_TYPE));
+ // FIXME this can end up generating Objects.hash against arrays
line = getReturnString(OBJECT_STRING + SUFFIX_S + PERIOD + HASH +
OPEN_PARENTHESIS, EIGHT_SPACE_INDENTATION);
builder.append(line);
diff --git a/model/src/test/java/org/onosproject/yang/model/ResourceIdTest.java b/model/src/test/java/org/onosproject/yang/model/ResourceIdTest.java
index fd203aa..4fdc600 100644
--- a/model/src/test/java/org/onosproject/yang/model/ResourceIdTest.java
+++ b/model/src/test/java/org/onosproject/yang/model/ResourceIdTest.java
@@ -56,6 +56,7 @@
.testEquals();
}
+ @Test
public void appendNodeKeys() throws CloneNotSupportedException {
ResourceId devices = ResourceId.builder()
.append(ridA.nodeKeys().subList(1, 2))
diff --git a/runtime/src/main/java/org/onosproject/yang/runtime/impl/DefaultYangModelRegistry.java b/runtime/src/main/java/org/onosproject/yang/runtime/impl/DefaultYangModelRegistry.java
index 8aad2b4..5d7c0e6 100644
--- a/runtime/src/main/java/org/onosproject/yang/runtime/impl/DefaultYangModelRegistry.java
+++ b/runtime/src/main/java/org/onosproject/yang/runtime/impl/DefaultYangModelRegistry.java
@@ -152,7 +152,7 @@
updateRegClassStore(param);
modelIdStore.put(id, model);
} else if ((info != null) && (!registerClassStore
- .containsKey(info.getModuleClass()))) {
+ .containsValue(info.getModuleClass()))) {
updateRegClassStore(param);
} else {
throw new IllegalArgumentException(E_MEXIST);