Bump byte-buddy to 1.14.16
[mdsal.git] / binding / mdsal-binding-generator / src / main / java / org / opendaylight / mdsal / binding / generator / impl / reactor / InputGenerator.java
1 /*
2  * Copyright (c) 2022 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.reactor.CollisionDomain.Member;
12 import org.opendaylight.mdsal.binding.generator.impl.rt.DefaultInputRuntimeType;
13 import org.opendaylight.mdsal.binding.model.api.GeneratedType;
14 import org.opendaylight.mdsal.binding.model.ri.BindingTypes;
15 import org.opendaylight.mdsal.binding.runtime.api.AugmentRuntimeType;
16 import org.opendaylight.mdsal.binding.runtime.api.InputRuntimeType;
17 import org.opendaylight.mdsal.binding.runtime.api.RuntimeType;
18 import org.opendaylight.yangtools.yang.binding.contract.StatementNamespace;
19 import org.opendaylight.yangtools.yang.model.api.stmt.InputEffectiveStatement;
20
21 /**
22  * Generator corresponding to an {@code input} statement. We use a combination of the operation name and "Input"
23  * as the name. This makes it easier to support multiple RPCs/actions in one source file, as we can import them without
24  * a conflict.
25  */
26 final class InputGenerator extends OperationContainerGenerator<InputEffectiveStatement, InputRuntimeType> {
27     InputGenerator(final InputEffectiveStatement statement, final AbstractCompositeGenerator<?, ?> parent) {
28         super(statement, parent, BindingTypes.RPC_INPUT);
29     }
30
31     @Override
32     StatementNamespace namespace() {
33         return StatementNamespace.INPUT;
34     }
35
36     @Override
37     Member createMember(final CollisionDomain domain, final Member parent) {
38         return domain.addSecondary(this, parent);
39     }
40
41     @Override
42     CompositeRuntimeTypeBuilder<InputEffectiveStatement, InputRuntimeType> createBuilder(
43             final InputEffectiveStatement statement) {
44         return new CompositeRuntimeTypeBuilder<>(statement) {
45             @Override
46             InputRuntimeType build(final GeneratedType type, final InputEffectiveStatement statement,
47                     final List<RuntimeType> children, final List<AugmentRuntimeType> augments) {
48                 return new DefaultInputRuntimeType(type, statement, children, augments);
49             }
50         };
51     }
52 }