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.OpenDaylightExtensionsStatements;
13 import org.opendaylight.yangtools.odlext.model.api.RpcContextReferenceEffectiveStatement;
14 import org.opendaylight.yangtools.odlext.model.api.RpcContextReferenceStatement;
15 import org.opendaylight.yangtools.yang.model.api.meta.DeclarationReference;
16 import org.opendaylight.yangtools.yang.model.api.meta.DeclaredStatement;
17 import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
18 import org.opendaylight.yangtools.yang.parser.api.YangParserConfiguration;
19 import org.opendaylight.yangtools.yang.parser.spi.meta.AbstractStringStatementSupport;
20 import org.opendaylight.yangtools.yang.parser.spi.meta.BoundStmtCtx;
21 import org.opendaylight.yangtools.yang.parser.spi.meta.EffectiveStmtCtx.Current;
22 import org.opendaylight.yangtools.yang.parser.spi.meta.SubstatementValidator;
25 public final class RpcContextReferenceStatementSupport
26 extends AbstractStringStatementSupport<RpcContextReferenceStatement, RpcContextReferenceEffectiveStatement> {
27 private static final SubstatementValidator VALIDATOR =
28 SubstatementValidator.builder(OpenDaylightExtensionsStatements.RPC_CONTEXT_REFERENCE).build();
30 public RpcContextReferenceStatementSupport(final YangParserConfiguration config) {
31 super(OpenDaylightExtensionsStatements.RPC_CONTEXT_REFERENCE, StatementPolicy.contextIndependent(), config,
36 protected RpcContextReferenceStatement createDeclared(final BoundStmtCtx<String> ctx,
37 final ImmutableList<DeclaredStatement<?>> substatements) {
38 return new RpcContextReferenceStatementImpl(ctx.getArgument(), substatements);
42 protected RpcContextReferenceStatement attachDeclarationReference(final RpcContextReferenceStatement stmt,
43 final DeclarationReference reference) {
44 return new RefRpcContextReferenceStatement(stmt, reference);
48 protected RpcContextReferenceEffectiveStatement createEffective(
49 final Current<String, RpcContextReferenceStatement> stmt,
50 final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
51 return new RpcContextReferenceEffectiveStatementImpl(stmt.declared(), substatements);