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.EffectiveStmtCtx.Current;
21 import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
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(
37 final StmtContext<String, RpcContextReferenceStatement, ?> ctx,
38 final ImmutableList<? extends DeclaredStatement<?>> substatements) {
39 return new RpcContextReferenceStatementImpl(ctx.getArgument(), substatements);
43 protected RpcContextReferenceStatement attachDeclarationReference(final RpcContextReferenceStatement stmt,
44 final DeclarationReference reference) {
45 return new RefRpcContextReferenceStatement(stmt, reference);
49 protected RpcContextReferenceEffectiveStatement createEffective(
50 final Current<String, RpcContextReferenceStatement> stmt,
51 final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
52 return new RpcContextReferenceEffectiveStatementImpl(stmt.declared(), substatements);