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.rt;
10 import static java.util.Objects.requireNonNull;
12 import com.google.common.annotations.Beta;
13 import com.google.common.collect.ImmutableMap;
14 import com.google.common.collect.Maps;
15 import java.util.List;
16 import org.opendaylight.mdsal.binding.model.api.GeneratedType;
17 import org.opendaylight.mdsal.binding.runtime.api.ModuleRuntimeType;
18 import org.opendaylight.mdsal.binding.runtime.api.RuntimeType;
19 import org.opendaylight.mdsal.binding.runtime.api.YangDataRuntimeType;
20 import org.opendaylight.yangtools.yang.common.YangDataName;
21 import org.opendaylight.yangtools.yang.model.api.stmt.ModuleEffectiveStatement;
24 public final class DefaultModuleRuntimeType extends AbstractCompositeRuntimeType<ModuleEffectiveStatement>
25 implements ModuleRuntimeType {
26 private final ImmutableMap<YangDataName, YangDataRuntimeType> yangDataChildren;
28 public DefaultModuleRuntimeType(final GeneratedType bindingType, final ModuleEffectiveStatement statement,
29 final List<RuntimeType> children, final List<YangDataRuntimeType> yangDataChildren) {
30 super(bindingType, statement, children);
31 this.yangDataChildren = Maps.uniqueIndex(yangDataChildren, type -> type.statement().argument());
35 public YangDataRuntimeType yangDataChild(final YangDataName templateName) {
36 return yangDataChildren.get(requireNonNull(templateName));