Rework AugmentRuntimeType and Choice/Case linkage
[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 org.opendaylight.mdsal.binding.model.api.GeneratedType;
11 import org.opendaylight.mdsal.binding.model.api.type.builder.GeneratedTypeBuilderBase;
12 import org.opendaylight.mdsal.binding.runtime.api.RpcRuntimeType;
13 import org.opendaylight.yangtools.yang.model.api.stmt.RpcEffectiveStatement;
14 import org.opendaylight.yangtools.yang.model.util.SchemaInferenceStack;
15
16 /**
17  * Generator corresponding to a {@code rpc} statement.
18  */
19 // FIXME: hide this once we have RpcRuntimeType
20 public final class RpcGenerator extends CompositeSchemaTreeGenerator<RpcEffectiveStatement, RpcRuntimeType> {
21     RpcGenerator(final RpcEffectiveStatement statement, final AbstractCompositeGenerator<?, ?> parent) {
22         super(statement, parent);
23     }
24
25     @Override
26     void pushToInference(final SchemaInferenceStack dataTree) {
27         dataTree.enterSchemaTree(statement().argument());
28     }
29
30     @Override
31     // FIXME: switch to the same thing we are using for 'action'
32     ClassPlacement classPlacement() {
33         return ClassPlacement.PHANTOM;
34     }
35
36     @Override
37     GeneratedType createTypeImpl(final TypeBuilderFactory builderFactory) {
38         throw new UnsupportedOperationException();
39     }
40
41     @Override
42     void addAsGetterMethod(final GeneratedTypeBuilderBase<?> builder, final TypeBuilderFactory builderFactory) {
43         // RPCs are a separate concept
44     }
45
46     @Override
47     CompositeRuntimeTypeBuilder<RpcEffectiveStatement, RpcRuntimeType> createBuilder(
48             final RpcEffectiveStatement statement) {
49         // RPCs do not have a dedicated interface
50         throw new UnsupportedOperationException("Should never be called");
51     }
52 }