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 java.util.List;
11 import org.opendaylight.mdsal.binding.generator.impl.rt.DefaultContainerRuntimeType;
12 import org.opendaylight.mdsal.binding.model.api.GeneratedType;
13 import org.opendaylight.mdsal.binding.model.api.type.builder.GeneratedTypeBuilder;
14 import org.opendaylight.mdsal.binding.runtime.api.AugmentRuntimeType;
15 import org.opendaylight.mdsal.binding.runtime.api.ContainerRuntimeType;
16 import org.opendaylight.mdsal.binding.runtime.api.RuntimeType;
17 import org.opendaylight.yangtools.yang.model.api.stmt.ContainerEffectiveStatement;
18 import org.opendaylight.yangtools.yang.model.util.SchemaInferenceStack;
21 * Generator corresponding to a {@code container} statement.
23 final class ContainerGenerator extends CompositeSchemaTreeGenerator<ContainerEffectiveStatement, ContainerRuntimeType> {
24 ContainerGenerator(final ContainerEffectiveStatement statement, final AbstractCompositeGenerator<?, ?> parent) {
25 super(statement, parent);
29 void pushToInference(final SchemaInferenceStack dataTree) {
30 dataTree.enterDataTree(statement().getIdentifier());
34 GeneratedType createTypeImpl(final TypeBuilderFactory builderFactory) {
35 final GeneratedTypeBuilder builder = builderFactory.newGeneratedTypeBuilder(typeName());
36 addImplementsChildOf(builder);
37 addAugmentable(builder);
38 addUsesInterfaces(builder, builderFactory);
39 addConcreteInterfaceMethods(builder);
41 final ModuleGenerator module = currentModule();
42 module.addQNameConstant(builder, localName());
44 addGetterMethods(builder, builderFactory);
46 annotateDeprecatedIfNecessary(builder);
47 builderFactory.addCodegenInformation(module, statement(), builder);
48 builder.setModuleName(module.statement().argument().getLocalName());
49 // builder.setSchemaPath(node.getPath());
51 return builder.build();
55 CompositeRuntimeTypeBuilder<ContainerEffectiveStatement, ContainerRuntimeType> createBuilder(
56 final ContainerEffectiveStatement statement) {
57 return new CompositeRuntimeTypeBuilder<>(statement) {
59 ContainerRuntimeType build(final GeneratedType type, final ContainerEffectiveStatement statement,
60 final List<RuntimeType> children, final List<AugmentRuntimeType> augments) {
61 return new DefaultContainerRuntimeType(type, statement, children, augments);