2 * Copyright (c) 2020 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.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.ElementCountConstraint;
18 import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
19 import org.opendaylight.yangtools.yang.model.api.stmt.LeafListStatement;
21 abstract class AbstractNonEmptyLeafListEffectiveStatement extends AbstractLeafListEffectiveStatement {
22 private final @Nullable ElementCountConstraint elementCountConstraint;
23 private final @NonNull QName argument;
25 AbstractNonEmptyLeafListEffectiveStatement(final LeafListStatement declared, final QName argument, final int flags,
26 final ImmutableList<? extends EffectiveStatement<?, ?>> substatements,
27 final ElementCountConstraint elementCountConstraint) {
28 super(declared, flags, substatements);
29 this.argument = requireNonNull(argument);
30 this.elementCountConstraint = elementCountConstraint;
33 AbstractNonEmptyLeafListEffectiveStatement(final AbstractNonEmptyLeafListEffectiveStatement originalEffecive,
34 final QName argument, final int flags) {
35 super(originalEffecive, flags);
36 this.argument = requireNonNull(argument);
37 elementCountConstraint = originalEffecive.elementCountConstraint;
40 AbstractNonEmptyLeafListEffectiveStatement(final EmptyLeafListEffectiveStatement originalEffective,
41 final QName argument, final int flags) {
42 super(originalEffective, flags);
43 this.argument = requireNonNull(argument);
44 elementCountConstraint = null;
48 public final QName argument() {
53 public final Optional<ElementCountConstraint> getElementCountConstraint() {
54 return Optional.ofNullable(elementCountConstraint);