- genCtx.get(module).addChoiceToCaseMapping(refChoiceType, caseTypeBuilder, caseNode);
- final Iterable<DataSchemaNode> caseChildNodes = caseNode.getChildNodes();
- if (caseChildNodes != null) {
- final SchemaPath choiceNodeParentPath = choiceNode.getPath().getParent();
-
- if (!Iterables.isEmpty(choiceNodeParentPath.getPathFromRoot())) {
- SchemaNode parent = findDataSchemaNode(schemaContext, choiceNodeParentPath);
-
- if (parent instanceof AugmentationSchema) {
- final AugmentationSchema augSchema = (AugmentationSchema) parent;
- final SchemaPath targetPath = augSchema.getTargetPath();
- SchemaNode targetSchemaNode = findDataSchemaNode(schemaContext, targetPath);
- if (targetSchemaNode instanceof DataSchemaNode
- && ((DataSchemaNode) targetSchemaNode).isAddedByUses()) {
- if (targetSchemaNode instanceof DerivableSchemaNode) {
- targetSchemaNode = ((DerivableSchemaNode) targetSchemaNode).getOriginal().orNull();
- }
- if (targetSchemaNode == null) {
- throw new IllegalStateException(
- "Failed to find target node from grouping for augmentation " + augSchema
- + " in module " + module.getName());
- }
- }
- parent = targetSchemaNode;
- }
-
- Preconditions.checkState(parent != null, "Could not find Choice node parent %s",
- choiceNodeParentPath);
- GeneratedTypeBuilder childOfType = findChildNodeByPath(parent.getPath(), genCtx);
- if (childOfType == null) {
- childOfType = findGroupingByPath(parent.getPath(), genCtx);
- }
- resolveDataSchemaNodes(module, basePackageName, caseTypeBuilder, childOfType, caseChildNodes,
- genCtx, schemaContext, verboseClassComments, genTypeBuilders, typeProvider, namespaceType);
- } else {
- final GeneratedTypeBuilder moduleType = genCtx.get(module).getModuleNode();
- Preconditions.checkNotNull(moduleType, "Module type can not be null.");
- resolveDataSchemaNodes(module, basePackageName, caseTypeBuilder, moduleType, caseChildNodes,
- genCtx, schemaContext, verboseClassComments, genTypeBuilders, typeProvider, namespaceType);
- }
- processUsesImplements(caseNode, module, schemaContext, genCtx, namespaceType);