2 * Copyright (c) 2015 Cisco Systems, Inc. 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.yangtools.yang.model.ri.stmt.impl.eff;
10 import static java.util.Objects.requireNonNull;
12 import com.google.common.collect.ImmutableList;
13 import java.util.Optional;
14 import org.eclipse.jdt.annotation.NonNull;
15 import org.eclipse.jdt.annotation.Nullable;
16 import org.opendaylight.yangtools.yang.common.QName;
17 import org.opendaylight.yangtools.yang.model.api.CaseSchemaNode;
18 import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
19 import org.opendaylight.yangtools.yang.model.api.stmt.ChoiceStatement;
21 public final class RegularChoiceEffectiveStatement extends AbstractChoiceEffectiveStatement {
22 private final CaseSchemaNode defaultCase;
23 private final @NonNull QName argument;
25 public RegularChoiceEffectiveStatement(final ChoiceStatement declared,
26 final ImmutableList<? extends EffectiveStatement<?, ?>> substatements, final QName argument,
27 final int flags, final @Nullable CaseSchemaNode defaultCase) {
28 super(declared, substatements, flags);
29 this.argument = requireNonNull(argument);
30 this.defaultCase = defaultCase;
33 public RegularChoiceEffectiveStatement(final AbstractChoiceEffectiveStatement original, final QName argument,
35 super(original, flags);
36 this.argument = requireNonNull(argument);
37 defaultCase = original.getDefaultCase().orElse(null);
41 public QName argument() {
46 public Optional<CaseSchemaNode> getDefaultCase() {
47 return Optional.ofNullable(defaultCase);