2 * Copyright (c) 2022 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.collect.Collections2;
11 import java.util.Collection;
12 import java.util.List;
13 import org.opendaylight.mdsal.binding.model.api.GeneratedType;
14 import org.opendaylight.mdsal.binding.model.api.JavaTypeName;
15 import org.opendaylight.mdsal.binding.runtime.api.AugmentRuntimeType;
16 import org.opendaylight.mdsal.binding.runtime.api.CaseRuntimeType;
17 import org.opendaylight.mdsal.binding.runtime.api.ChoiceRuntimeType;
18 import org.opendaylight.mdsal.binding.runtime.api.RuntimeType;
19 import org.opendaylight.yangtools.yang.model.api.stmt.ChoiceEffectiveStatement;
21 abstract class AbstractChoiceRuntimeType extends AbstractCompositeRuntimeType<ChoiceEffectiveStatement>
22 implements ChoiceRuntimeType {
23 AbstractChoiceRuntimeType(final GeneratedType bindingType, final ChoiceEffectiveStatement statement,
24 final List<RuntimeType> children, final List<AugmentRuntimeType> augments) {
25 super(bindingType, statement, children, augments);
29 public final Collection<CaseRuntimeType> validCaseChildren() {
30 return (Collection) Collections2.filter(schemaTreeChildren(), CaseRuntimeType.class::isInstance);
34 public final CaseRuntimeType bindingCaseChild(final JavaTypeName typeName) {
35 final var child = bindingChild(typeName);
36 return child instanceof CaseRuntimeType ? (CaseRuntimeType) child : null;