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.mdsal.binding.generator.impl.reactor;
10 import java.util.List;
11 import org.opendaylight.mdsal.binding.generator.impl.rt.DefaultRpcRuntimeType;
12 import org.opendaylight.mdsal.binding.model.api.GeneratedType;
13 import org.opendaylight.mdsal.binding.model.api.ParameterizedType;
14 import org.opendaylight.mdsal.binding.model.ri.BindingTypes;
15 import org.opendaylight.mdsal.binding.runtime.api.RpcRuntimeType;
16 import org.opendaylight.mdsal.binding.runtime.api.RuntimeType;
17 import org.opendaylight.yangtools.yang.binding.contract.StatementNamespace;
18 import org.opendaylight.yangtools.yang.model.api.stmt.RpcEffectiveStatement;
21 * Generator corresponding to a {@code rpc} statement.
23 // FIXME: hide this once we have RpcRuntimeType
24 public final class RpcGenerator extends AbstractInvokableGenerator<RpcEffectiveStatement, RpcRuntimeType> {
25 RpcGenerator(final RpcEffectiveStatement statement, final ModuleGenerator parent) {
26 super(statement, parent);
30 StatementNamespace namespace() {
31 return StatementNamespace.RPC;
35 ClassPlacement classPlacement() {
36 return ClassPlacement.TOP_LEVEL;
40 ParameterizedType implementedType(final TypeBuilderFactory builderFactory, final GeneratedType input,
41 final GeneratedType output) {
42 return BindingTypes.rpc(input, output);
46 CompositeRuntimeTypeBuilder<RpcEffectiveStatement, RpcRuntimeType> createBuilder(
47 final RpcEffectiveStatement statement) {
48 return new InvokableRuntimeTypeBuilder<>(statement) {
50 RpcRuntimeType build(final GeneratedType generatedType, final RpcEffectiveStatement statement,
51 final List<RuntimeType> childTypes) {
52 return new DefaultRpcRuntimeType(generatedType, statement, childTypes);