985ac81dd3f581a828171aee1e06cb7753c81a9d
[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.model.api.GeneratedType;
12 import org.opendaylight.mdsal.binding.model.api.type.builder.GeneratedTypeBuilderBase;
13 import org.opendaylight.mdsal.binding.runtime.api.AugmentRuntimeType;
14 import org.opendaylight.mdsal.binding.runtime.api.RpcRuntimeType;
15 import org.opendaylight.mdsal.binding.runtime.api.RuntimeType;
16 import org.opendaylight.yangtools.yang.model.api.stmt.RpcEffectiveStatement;
17 import org.opendaylight.yangtools.yang.model.util.SchemaInferenceStack;
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 CompositeSchemaTreeGenerator<RpcEffectiveStatement, RpcRuntimeType> {
24     RpcGenerator(final RpcEffectiveStatement statement, final AbstractCompositeGenerator<?, ?> parent) {
25         super(statement, parent);
26     }
27
28     @Override
29     void pushToInference(final SchemaInferenceStack dataTree) {
30         dataTree.enterSchemaTree(statement().argument());
31     }
32
33     @Override
34     // FIXME: switch to the same thing we are using for 'action'
35     ClassPlacement classPlacement() {
36         return ClassPlacement.PHANTOM;
37     }
38
39     @Override
40     GeneratedType createTypeImpl(final TypeBuilderFactory builderFactory) {
41         throw new UnsupportedOperationException();
42     }
43
44     @Override
45     RpcRuntimeType createRuntimeType(final GeneratedType type, final RpcEffectiveStatement statement,
46             final List<RuntimeType> children, final List<AugmentRuntimeType> augments) {
47         throw new UnsupportedOperationException();
48     }
49
50     @Override
51     void addAsGetterMethod(final GeneratedTypeBuilderBase<?> builder, final TypeBuilderFactory builderFactory) {
52         // RPCs are a separate concept
53     }
54 }