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;
20 import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.Utils;
22 abstract class AbstractEffectiveSchemaNode<D extends DeclaredStatement<QName>> extends
23 AbstractEffectiveDocumentedNode<QName, D> implements SchemaNode {
25 private final QName qname;
26 private final SchemaPath path;
27 private final List<UnknownSchemaNode> unknownNodes;
29 AbstractEffectiveSchemaNode(StmtContext<QName, D, ?> ctx) {
31 this.qname = ctx.getStatementArgument();
32 this.path = Utils.getSchemaPath(ctx);
34 Collection<? extends EffectiveStatement<?, ?>> effectiveSubstatements = effectiveSubstatements();
35 ImmutableList.Builder<UnknownSchemaNode> listBuilder = new ImmutableList.Builder<>();
36 for (EffectiveStatement<?, ?> effectiveStatement : effectiveSubstatements) {
37 if (effectiveStatement instanceof UnknownSchemaNode) {
38 listBuilder.add((UnknownSchemaNode) effectiveStatement);
41 this.unknownNodes = listBuilder.build();
45 public QName getQName() {
50 public SchemaPath getPath() {
55 public List<UnknownSchemaNode> getUnknownSchemaNodes() {