Remove DerivableSchemaNode
[yangtools.git] / model / yang-model-ri / src / main / java / org / opendaylight / yangtools / yang / model / ri / stmt / impl / eff / AbstractNonEmptyLeafListEffectiveStatement.java
1 /*
2  * Copyright (c) 2020 PANTHEON.tech, s.r.o. and others.  All rights reserved.
3  *
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
7  */
8 package org.opendaylight.yangtools.yang.model.ri.stmt.impl.eff;
9
10 import com.google.common.collect.ImmutableList;
11 import java.util.Optional;
12 import org.eclipse.jdt.annotation.Nullable;
13 import org.opendaylight.yangtools.yang.common.QName;
14 import org.opendaylight.yangtools.yang.model.api.ElementCountConstraint;
15 import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
16 import org.opendaylight.yangtools.yang.model.api.stmt.LeafListStatement;
17
18 abstract class AbstractNonEmptyLeafListEffectiveStatement extends AbstractLeafListEffectiveStatement {
19     private final @Nullable ElementCountConstraint elementCountConstraint;
20
21     AbstractNonEmptyLeafListEffectiveStatement(final LeafListStatement declared, final QName argument, final int flags,
22             final ImmutableList<? extends EffectiveStatement<?, ?>> substatements,
23             final ElementCountConstraint elementCountConstraint) {
24         super(declared, argument, flags, substatements);
25         this.elementCountConstraint = elementCountConstraint;
26     }
27
28     AbstractNonEmptyLeafListEffectiveStatement(final AbstractNonEmptyLeafListEffectiveStatement originalEffecive,
29             final QName argument, final int flags) {
30         super(originalEffecive, argument, flags);
31         elementCountConstraint = originalEffecive.elementCountConstraint;
32     }
33
34     AbstractNonEmptyLeafListEffectiveStatement(final EmptyLeafListEffectiveStatement originalEffective,
35             final QName argument, final int flags) {
36         super(originalEffective, argument, flags);
37         elementCountConstraint = null;
38     }
39
40     @Override
41     public final Optional<ElementCountConstraint> getElementCountConstraint() {
42         return Optional.ofNullable(elementCountConstraint);
43     }
44 }