2 * Copyright (c) 2016 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.thirdparty.plugin;
10 import com.google.common.collect.ImmutableList;
11 import org.eclipse.jdt.annotation.Nullable;
12 import org.opendaylight.yangtools.yang.common.Empty;
13 import org.opendaylight.yangtools.yang.common.QName;
14 import org.opendaylight.yangtools.yang.model.api.SchemaNodeDefaults;
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.parser.rfc7950.stmt.UnknownEffectiveStatementBase;
18 import org.opendaylight.yangtools.yang.parser.spi.meta.EffectiveStmtCtx.Current;
19 import org.opendaylight.yangtools.yang.parser.spi.meta.SchemaPathSupport;
21 final class ThirdPartyExtensionEffectiveStatementImpl
22 extends UnknownEffectiveStatementBase<String, ThirdPartyExtensionStatement>
23 implements ThirdPartyExtensionEffectiveStatement {
25 private final @Nullable SchemaPath path;
26 private final String valueFromNamespace;
28 ThirdPartyExtensionEffectiveStatementImpl(final Current<String, ThirdPartyExtensionStatement> stmt,
29 final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
30 super(stmt, substatements);
31 path = SchemaPathSupport.toOptionalPath(stmt.getEffectiveParent().getSchemaPath().createChild(getNodeType()));
32 valueFromNamespace = stmt.getFromNamespace(ThirdPartyNamespace.class, Empty.getInstance());
36 public String getValueFromNamespace() {
37 return valueFromNamespace;
41 public QName getQName() {
47 public SchemaPath getPath() {
48 return SchemaNodeDefaults.throwUnsupportedIfNull(this, path);
52 public ThirdPartyExtensionEffectiveStatement asEffectiveStatement() {