Refactor mdsal-binding-generator artifacts
[mdsal.git] / binding / mdsal-binding-generator / src / main / java / org / opendaylight / mdsal / binding / generator / impl / reactor / ModuleAugmentGenerator.java
diff --git a/binding/mdsal-binding-generator/src/main/java/org/opendaylight/mdsal/binding/generator/impl/reactor/ModuleAugmentGenerator.java b/binding/mdsal-binding-generator/src/main/java/org/opendaylight/mdsal/binding/generator/impl/reactor/ModuleAugmentGenerator.java
new file mode 100644 (file)
index 0000000..98d29ad
--- /dev/null
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 2021 PANTHEON.tech, s.r.o. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.mdsal.binding.generator.impl.reactor;
+
+import org.opendaylight.yangtools.yang.model.api.stmt.AugmentEffectiveStatement;
+
+/**
+ * Generator corresponding to a {@code augment} statement used as a child of a {@code module} statement.
+ */
+final class ModuleAugmentGenerator extends AbstractAugmentGenerator {
+    ModuleAugmentGenerator(final AugmentEffectiveStatement statement, final AbstractCompositeGenerator<?> parent) {
+        super(statement, parent);
+    }
+
+    @Override
+    void loadTargetGenerator() {
+        throw new UnsupportedOperationException();
+    }
+
+    void linkAugmentationTarget(final GeneratorContext context) {
+        // FIXME: we need two-step resolution here:
+
+//      if (targetSchemaNode instanceof DataSchemaNode && ((DataSchemaNode) targetSchemaNode).isAddedByUses()) {
+//          if (targetSchemaNode instanceof DerivableSchemaNode) {
+//              targetSchemaNode = ((DerivableSchemaNode) targetSchemaNode).getOriginal().orElse(null);
+//          }
+//          if (targetSchemaNode == null) {
+//              throw new IllegalStateException("Failed to find target node from grouping in augmentation " + augSchema
+//                  + " in module " + context.module().getName());
+//          }
+//      }
+
+        setTargetGenerator(context.resolveSchemaNode(statement().argument()));
+    }
+}