2 * Copyright (c) 2021 PANTHEON.tech, s.r.o. and others. All rights reserved.
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
8 package org.opendaylight.mdsal.binding.generator.impl.reactor;
10 import org.opendaylight.mdsal.binding.model.api.GeneratedType;
11 import org.opendaylight.mdsal.binding.model.api.Type;
12 import org.opendaylight.mdsal.binding.model.api.type.builder.GeneratedTypeBuilder;
13 import org.opendaylight.mdsal.binding.model.ri.BindingTypes;
14 import org.opendaylight.yangtools.yang.model.api.stmt.ChoiceEffectiveStatement;
15 import org.opendaylight.yangtools.yang.model.util.SchemaInferenceStack;
18 * Generator corresponding to a {@code choice} statement.
20 final class ChoiceGenerator extends CompositeSchemaTreeGenerator<ChoiceEffectiveStatement, ChoiceGenerator> {
21 ChoiceGenerator(final ChoiceEffectiveStatement statement, final AbstractCompositeGenerator<?> parent) {
22 super(statement, parent);
26 void pushToInference(final SchemaInferenceStack dataTree) {
31 GeneratedType createTypeImpl(final TypeBuilderFactory builderFactory) {
32 final GeneratedTypeBuilder builder = builderFactory.newGeneratedTypeBuilder(typeName());
33 builder.addImplementsType(BindingTypes.choiceIn(Type.of(getParent().typeName())));
35 final ModuleGenerator module = currentModule();
36 module.addQNameConstant(builder, localName());
38 annotateDeprecatedIfNecessary(builder);
39 builderFactory.addCodegenInformation(module, statement(), builder);
40 // newType.setSchemaPath(schemaNode.getPath());
41 builder.setModuleName(module.statement().argument().getLocalName());
43 return builder.build();