Add a ModuleAugmentGenerator FIXME
[mdsal.git] / binding / mdsal-binding-generator / src / main / java / org / opendaylight / mdsal / binding / generator / impl / reactor / ModuleAugmentGenerator.java
1 /*
2  * Copyright (c) 2021 PANTHEON.tech, s.r.o. and others.  All rights reserved.
3  *
4  * This program and the accompanying materials are made available under the
5  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6  * and is available at http://www.eclipse.org/legal/epl-v10.html
7  */
8 package org.opendaylight.mdsal.binding.generator.impl.reactor;
9
10 import org.opendaylight.yangtools.yang.model.api.stmt.AugmentEffectiveStatement;
11
12 /**
13  * Generator corresponding to a {@code augment} statement used as a child of a {@code module} statement.
14  */
15 final class ModuleAugmentGenerator extends AbstractAugmentGenerator {
16     ModuleAugmentGenerator(final AugmentEffectiveStatement statement, final AbstractCompositeGenerator<?> parent) {
17         super(statement, parent);
18     }
19
20     @Override
21     void loadTargetGenerator() {
22         throw new UnsupportedOperationException();
23     }
24
25     void linkAugmentationTarget(final GeneratorContext context) {
26         // FIXME: do we need two-step resolution here? we probably have solved this somehow, or it's part of...
27         // FIXME: MDSAL-696: this looks like the sort of check which should be involved in replacing getOriginal()
28         //
29         //      if (targetSchemaNode instanceof DataSchemaNode && ((DataSchemaNode) targetSchemaNode).isAddedByUses()) {
30         //          if (targetSchemaNode instanceof DerivableSchemaNode) {
31         //              targetSchemaNode = ((DerivableSchemaNode) targetSchemaNode).getOriginal().orElse(null);
32         //          }
33         //          if (targetSchemaNode == null) {
34         //              throw new IllegalStateException("Failed to find target node from grouping in augmentation "
35         //                  + augSchema + " in module " + context.module().getName());
36         //          }
37         //      }
38
39         setTargetGenerator(context.resolveSchemaNode(statement().argument()));
40     }
41 }