+
+ static void addUsesImplements(final DataNodeContainer superNode, final Module superModule,
+ final DataNodeContainer node, final Module module,
+ final SchemaContext schemaContext, Map<Module, ModuleContext> genCtx, final BindingNamespaceType namespaceType ) {
+ for (SchemaNode superChildNode : superNode.getChildNodes()) {
+ if (superChildNode instanceof DataNodeContainer) {
+ final QName childQName = QName.create(((SchemaNode)node).getQName(), superChildNode.getQName().getLocalName());
+ DataSchemaNode childNode = node.getDataChildByName(childQName);
+ Preconditions.checkNotNull(childNode, ((SchemaNode) node).getPath() + "->" + childQName.toString());
+
+ final GeneratedTypeBuilder type = genCtx.get(module).getChildNode(childNode.getPath());
+ final GeneratedTypeBuilder superType = genCtx.get(superModule).getChildNode(superChildNode.getPath());
+
+ //TODO:delete this after supporting uses augment
+ if (type == null || superType == null) {
+ return;
+ }
+ Preconditions.checkNotNull(type, module.toString() + "->" + childNode.getPath().toString());
+ Preconditions.checkNotNull(superType, superModule.toString() + "->" + superChildNode.getPath().toString());
+ type.addImplementsType(superType);
+ addUsesImplements((DataNodeContainer)superChildNode, superModule, (DataNodeContainer)childNode, module, schemaContext, genCtx, namespaceType);
+ }
+ }
+ }
+
+ static Map<Module, ModuleContext> processUsesImplements(final DataNodeContainer node, final Module module,
+ final SchemaContext schemaContext, Map<Module, ModuleContext> genCtx, final BindingNamespaceType namespaceType) {
+
+ for (final UsesNode usesNode : node.getUses()) {
+ final SchemaNode groupingNode = SchemaContextUtil.findDataSchemaNode(schemaContext, usesNode.getGroupingPath());
+ Preconditions.checkNotNull(groupingNode, module.toString() + "->"
+ + usesNode.getGroupingPath().toString());
+ Preconditions.checkState(groupingNode instanceof GroupingDefinition,
+ module.toString() + "->" + usesNode.getGroupingPath().toString());
+ final Module superModule = SchemaContextUtil.findParentModule(schemaContext, groupingNode);
+ GroupingDefinition grouping = (GroupingDefinition)groupingNode;
+ addUsesImplements(grouping, superModule, node, module, schemaContext, genCtx, namespaceType);
+ }
+ return genCtx;
+ }
+