Change action input/output naming strategy
[mdsal.git] / binding / mdsal-binding-generator / src / main / java / org / opendaylight / mdsal / binding / generator / impl / reactor / RpcGenerator.java
1 /*
2  * Copyright (c) 2021 PANTHEON.tech, s.r.o. and others.  All rights reserved.
3  *
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
7  */
8 package org.opendaylight.mdsal.binding.generator.impl.reactor;
9
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.model.api.stmt.RpcEffectiveStatement;
18
19 /**
20  * Generator corresponding to a {@code rpc} statement.
21  */
22 // FIXME: hide this once we have RpcRuntimeType
23 public final class RpcGenerator extends AbstractInvokableGenerator<RpcEffectiveStatement, RpcRuntimeType> {
24     RpcGenerator(final RpcEffectiveStatement statement, final ModuleGenerator parent) {
25         super(statement, parent);
26     }
27
28     @Override
29     ClassPlacement classPlacement() {
30         return ClassPlacement.TOP_LEVEL;
31     }
32
33     @Override
34     ParameterizedType implementedType(final TypeBuilderFactory builderFactory, final GeneratedType input,
35             final GeneratedType output) {
36         return BindingTypes.rpc(input, output);
37     }
38
39     @Override
40     CompositeRuntimeTypeBuilder<RpcEffectiveStatement, RpcRuntimeType> createBuilder(
41             final RpcEffectiveStatement statement) {
42         return new InvokableRuntimeTypeBuilder<>(statement) {
43             @Override
44             RpcRuntimeType build(final GeneratedType generatedType, final RpcEffectiveStatement statement,
45                     final List<RuntimeType> childTypes) {
46                 return new DefaultRpcRuntimeType(generatedType, statement, childTypes);
47             }
48         };
49     }
50 }