Ignore empty augmentations at runtime
[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 java.util.function.Function;
11 import org.eclipse.jdt.annotation.NonNull;
12 import org.opendaylight.yangtools.yang.model.api.stmt.AugmentEffectiveStatement;
13 import org.opendaylight.yangtools.yang.model.api.stmt.SchemaTreeAwareEffectiveStatement;
14
15 /**
16  * Generator corresponding to a {@code augment} statement used as a child of a {@code module} statement.
17  */
18 final class ModuleAugmentGenerator extends AbstractAugmentGenerator {
19     ModuleAugmentGenerator(final AugmentEffectiveStatement statement, final AbstractCompositeGenerator<?, ?> parent) {
20         super(statement, parent);
21     }
22
23     @Override
24     TargetAugmentEffectiveStatement effectiveIn(final SchemaTreeAwareEffectiveStatement<?, ?> target) {
25         return effectiveIn(target, Function.identity());
26     }
27
28     @NonNull AugmentRequirement startLinkage(final GeneratorContext context) {
29         return new AugmentRequirement(this,
30             context.resolveModule(statement().argument().firstNodeIdentifier().getModule()));
31     }
32 }