2 * Copyright (c) 2021 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.yangtools.odlext.parser;
10 import com.google.common.annotations.Beta;
11 import com.google.common.collect.ImmutableList;
12 import org.opendaylight.yangtools.odlext.model.api.ContextReferenceEffectiveStatement;
13 import org.opendaylight.yangtools.odlext.model.api.ContextReferenceStatement;
14 import org.opendaylight.yangtools.odlext.model.api.OpenDaylightExtensionsStatements;
15 import org.opendaylight.yangtools.yang.common.QName;
16 import org.opendaylight.yangtools.yang.model.api.meta.DeclarationReference;
17 import org.opendaylight.yangtools.yang.model.api.meta.DeclaredStatement;
18 import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
19 import org.opendaylight.yangtools.yang.model.api.stmt.IdentityEffectiveStatement;
20 import org.opendaylight.yangtools.yang.parser.api.YangParserConfiguration;
21 import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
24 public final class ContextReferenceStatementSupport
25 extends AbstractIdentityAwareStatementSupport<ContextReferenceStatement, ContextReferenceEffectiveStatement> {
26 public ContextReferenceStatementSupport(final YangParserConfiguration config) {
27 super(OpenDaylightExtensionsStatements.CONTEXT_REFERENCE, config);
31 protected ContextReferenceStatement createDeclared(final StmtContext<QName, ContextReferenceStatement, ?> ctx,
32 final ImmutableList<? extends DeclaredStatement<?>> substatements) {
33 return new ContextReferenceStatementImpl(ctx.rawArgument(), ctx.getArgument(), substatements);
37 protected ContextReferenceStatement attachDeclarationReference(final ContextReferenceStatement stmt,
38 final DeclarationReference reference) {
39 return new RefContextReferenceStatement(stmt, reference);
43 ContextReferenceEffectiveStatement createEffective(final ContextReferenceStatement declared,
44 final IdentityEffectiveStatement identity,
45 final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
46 return new ContextReferenceEffectiveStatementImpl(declared, identity, substatements);