2 * Copyright (c) 2020 PANTHEON.tech, s.r.o. and others. All rights reserved.
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
8 package org.opendaylight.mdsal.binding.generator.impl.reactor;
10 import org.opendaylight.yangtools.yang.model.api.stmt.AugmentEffectiveStatement;
13 * Generator corresponding to a {@code augment} statement used as a child of a {@code uses} statement.
15 final class UsesAugmentGenerator extends AbstractAugmentGenerator {
16 UsesAugmentGenerator(final AugmentEffectiveStatement statement, final AbstractCompositeGenerator<?> parent) {
17 super(statement, parent);
21 void loadTargetGenerator() {
22 // Here we are going in the opposite direction of RFC7950, section 7.13:
24 // The effect of a "uses" reference to a grouping is that the nodes
25 // defined by the grouping are copied into the current schema tree and
26 // are then updated according to the "refine" and "augment" statements.
28 // Our parent here is *not* the uses statement, but rather the statement which contains uses -- and its
29 // getSchemaTreeGenerator() is well equipped to deal with the namespace hopping needed to perform the lookups
30 setTargetGenerator(getParent().resolveSchemaNode(statement().argument()));