39d03628c262bfffcbb235e9f3587026b6f2db5e
[mdsal.git] / binding / mdsal-binding-generator / src / main / java / org / opendaylight / mdsal / binding / generator / impl / reactor / OutputGenerator.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.DefaultOutputRuntimeType;
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.OutputRuntimeType;
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.OutputEffectiveStatement;
20
21 /**
22  * Generator corresponding to an {@code output} statement.
23  */
24 // FIXME: hide this once we have RpcRuntimeType
25 public final class OutputGenerator extends OperationContainerGenerator<OutputEffectiveStatement, OutputRuntimeType> {
26     OutputGenerator(final OutputEffectiveStatement statement, final AbstractCompositeGenerator<?, ?> parent) {
27         super(statement, parent, BindingTypes.RPC_OUTPUT);
28     }
29
30     @Override
31     StatementNamespace namespace() {
32         return StatementNamespace.OUTPUT;
33     }
34
35     @Override
36     Member createMember(final CollisionDomain domain, final Member parent) {
37         return domain.addSecondary(this, parent);
38     }
39
40     @Override
41     CompositeRuntimeTypeBuilder<OutputEffectiveStatement, OutputRuntimeType> createBuilder(
42             final OutputEffectiveStatement statement) {
43         return new CompositeRuntimeTypeBuilder<>(statement) {
44             @Override
45             OutputRuntimeType build(final GeneratedType type, final OutputEffectiveStatement statement,
46                     final List<RuntimeType> children, final List<AugmentRuntimeType> augments) {
47                 return new DefaultOutputRuntimeType(type, statement, children, augments);
48             }
49         };
50     }
51 }