f4c01a3e7e0f38bab1a9135925e0eb0620033a9b
[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 import org.opendaylight.yangtools.yang.model.api.stmt.SchemaNodeIdentifier;
12
13 /**
14  * Generator corresponding to a {@code augment} statement used as a child of a {@code module} statement.
15  */
16 final class ModuleAugmentGenerator extends AbstractAugmentGenerator {
17     ModuleAugmentGenerator(final AugmentEffectiveStatement statement, final AbstractCompositeGenerator<?> parent) {
18         super(statement, parent);
19     }
20
21     @Override
22     void loadTargetGenerator() {
23         throw new UnsupportedOperationException();
24     }
25
26     void linkAugmentationTarget(final GeneratorContext context) {
27         final SchemaNodeIdentifier path = statement().argument();
28         final ModuleGenerator module = context.resolveModule(path.firstNodeIdentifier().getModule());
29         setTargetGenerator(module.resolveSchemaNode(path));
30     }
31 }