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.parser.stmt.rfc6020.effective;
10 import com.google.common.collect.ImmutableList;
11 import java.util.Collection;
12 import java.util.List;
13 import org.opendaylight.yangtools.yang.common.QName;
14 import org.opendaylight.yangtools.yang.model.api.SchemaNode;
15 import org.opendaylight.yangtools.yang.model.api.SchemaPath;
16 import org.opendaylight.yangtools.yang.model.api.UnknownSchemaNode;
17 import org.opendaylight.yangtools.yang.model.api.meta.DeclaredStatement;
18 import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
19 import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
21 abstract class AbstractEffectiveSchemaNode<D extends DeclaredStatement<QName>> extends
22 AbstractEffectiveDocumentedNode<QName, D> implements SchemaNode {
24 private final QName qname;
25 private final SchemaPath path;
26 private final List<UnknownSchemaNode> unknownNodes;
28 AbstractEffectiveSchemaNode(final StmtContext<QName, D, ?> ctx) {
30 this.qname = ctx.getStatementArgument();
31 this.path = ctx.getSchemaPath().get();
33 Collection<? extends EffectiveStatement<?, ?>> effectiveSubstatements = effectiveSubstatements();
34 ImmutableList.Builder<UnknownSchemaNode> listBuilder = new ImmutableList.Builder<>();
35 for (EffectiveStatement<?, ?> effectiveStatement : effectiveSubstatements) {
36 if (effectiveStatement instanceof UnknownSchemaNode) {
37 listBuilder.add((UnknownSchemaNode) effectiveStatement);
40 this.unknownNodes = listBuilder.build();
44 public QName getQName() {
49 public SchemaPath getPath() {
54 public List<UnknownSchemaNode> getUnknownSchemaNodes() {