Do not use StatementSourceReference in AbstractDeclaredEffectiveStatement
[yangtools.git] / yang / yang-parser-rfc7950 / src / main / java / org / opendaylight / yangtools / yang / parser / rfc7950 / stmt / list / RegularListEffectiveStatement.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.parser.rfc7950.stmt.list;
9
10 import com.google.common.collect.ImmutableList;
11 import java.util.Optional;
12 import org.opendaylight.yangtools.yang.common.QName;
13 import org.opendaylight.yangtools.yang.model.api.ElementCountConstraint;
14 import org.opendaylight.yangtools.yang.model.api.ListSchemaNode;
15 import org.opendaylight.yangtools.yang.model.api.SchemaPath;
16 import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
17 import org.opendaylight.yangtools.yang.model.api.stmt.ListStatement;
18
19 final class RegularListEffectiveStatement extends AbstractListEffectiveStatement {
20     private final ElementCountConstraint elementCountConstraint;
21     private final ListSchemaNode original;
22
23     RegularListEffectiveStatement(final ListStatement declared, final SchemaPath path, final int flags,
24             final ImmutableList<? extends EffectiveStatement<?, ?>> substatements,
25             final ImmutableList<QName> keyDefinition, final ElementCountConstraint elementCountConstraint,
26             final ListSchemaNode original) {
27         super(declared, path, flags, substatements, keyDefinition);
28         this.elementCountConstraint = elementCountConstraint;
29         this.original = original;
30     }
31
32     @Override
33     public Optional<ListSchemaNode> getOriginal() {
34         return Optional.ofNullable(original);
35     }
36
37     @Override
38     public Optional<ElementCountConstraint> getElementCountConstraint() {
39         return Optional.ofNullable(elementCountConstraint);
40     }
41 }