import static org.opendaylight.yangtools.binding.generator.util.Types.typeForClass;
import static org.opendaylight.yangtools.yang.model.util.SchemaContextUtil.findDataSchemaNode;
import static org.opendaylight.yangtools.yang.model.util.SchemaContextUtil.findNodeInSchemaContext;
-import static org.opendaylight.yangtools.yang.model.util.SchemaContextUtil.findOriginal;
import static org.opendaylight.yangtools.yang.model.util.SchemaContextUtil.findParentModule;
+import com.google.common.base.Splitter;
+import com.google.common.collect.Iterables;
+import com.google.common.collect.Sets;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.Set;
-
import org.opendaylight.yangtools.binding.generator.util.BindingGeneratorUtil;
import org.opendaylight.yangtools.binding.generator.util.BindingTypes;
import org.opendaylight.yangtools.binding.generator.util.ReferencedTypeImpl;
import org.opendaylight.yangtools.yang.model.api.ContainerSchemaNode;
import org.opendaylight.yangtools.yang.model.api.DataNodeContainer;
import org.opendaylight.yangtools.yang.model.api.DataSchemaNode;
+import org.opendaylight.yangtools.yang.model.api.DerivableSchemaNode;
import org.opendaylight.yangtools.yang.model.api.GroupingDefinition;
import org.opendaylight.yangtools.yang.model.api.IdentitySchemaNode;
import org.opendaylight.yangtools.yang.model.api.LeafListSchemaNode;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import com.google.common.base.Splitter;
-import com.google.common.collect.Iterables;
-import com.google.common.collect.Sets;
-
public class BindingGeneratorImpl implements BindingGenerator {
private static final Logger LOG = LoggerFactory.getLogger(BindingGeneratorImpl.class);
targetSchemaNode = findDataSchemaNode(schemaContext, targetPath);
if (targetSchemaNode instanceof DataSchemaNode && ((DataSchemaNode) targetSchemaNode).isAddedByUses()) {
- targetSchemaNode = findOriginal((DataSchemaNode) targetSchemaNode, schemaContext);
+ if (targetSchemaNode instanceof DerivableSchemaNode) {
+ targetSchemaNode = ((DerivableSchemaNode) targetSchemaNode).getOriginal().orNull();
+ }
if (targetSchemaNode == null) {
- throw new NullPointerException("Failed to find target node from grouping in augmentation " + augSchema
+ throw new IllegalStateException("Failed to find target node from grouping in augmentation " + augSchema
+ " in module " + module.getName());
}
}
SchemaNode targetSchemaNode = findDataSchemaNode(schemaContext, targetPath);
if (targetSchemaNode instanceof DataSchemaNode
&& ((DataSchemaNode) targetSchemaNode).isAddedByUses()) {
- targetSchemaNode = findOriginal((DataSchemaNode) targetSchemaNode, schemaContext);
+ if (targetSchemaNode instanceof DerivableSchemaNode) {
+ targetSchemaNode = ((DerivableSchemaNode) targetSchemaNode).getOriginal().orNull();
+ }
if (targetSchemaNode == null) {
- throw new NullPointerException(
+ throw new IllegalStateException(
"Failed to find target node from grouping for augmentation " + augSchema
+ " in module " + module.getName());
}
parent = findDataSchemaNode(schemaContext, sp.getParent());
}
GeneratedTypeBuilder childOfType = findChildNodeByPath(parent.getPath());
+ if (childOfType == null) {
+ childOfType = findGroupingByPath(parent.getPath());
+ }
resolveDataSchemaNodes(module, basePackageName, caseTypeBuilder, childOfType, caseChildNodes);
}
}