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 com.google.common.annotations.Beta;
11 import com.google.common.collect.ImmutableList;
12 import java.util.List;
13 import org.opendaylight.mdsal.binding.model.api.GeneratedType;
14 import org.opendaylight.mdsal.binding.runtime.api.ModuleRuntimeType;
15 import org.opendaylight.mdsal.binding.runtime.api.RuntimeType;
16 import org.opendaylight.mdsal.binding.runtime.api.YangDataRuntimeType;
17 import org.opendaylight.yangtools.yang.common.YangDataName;
18 import org.opendaylight.yangtools.yang.model.api.stmt.ModuleEffectiveStatement;
21 public final class DefaultModuleRuntimeType extends AbstractCompositeRuntimeType<ModuleEffectiveStatement>
22 implements ModuleRuntimeType {
23 private final ImmutableList<YangDataRuntimeType> yangDataChildren;
25 public DefaultModuleRuntimeType(final GeneratedType bindingType, final ModuleEffectiveStatement statement,
26 final List<RuntimeType> children) {
27 super(bindingType, statement, children);
28 yangDataChildren = children.stream()
29 .filter(YangDataRuntimeType.class::isInstance)
30 .map(YangDataRuntimeType.class::cast)
31 .collect(ImmutableList.toImmutableList());
35 public YangDataRuntimeType yangDataChild(final YangDataName templateName) {
36 if (statement().localQNameModule().equals(templateName.module())) {
37 final var name = templateName.name();
38 for (var child : yangDataChildren) {
39 if (name.equals(child.statement().argument())) {