70114076e9802905928be349c88617f21c533590
[yangtools.git] / parser / rfc6241-parser-support / src / main / java / org / opendaylight / yangtools / rfc6241 / parser / GetFilterElementAttributesEffectiveStatementImpl.java
1 /*
2  * Copyright (c) 2021 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.rfc6241.parser;
9
10 import com.google.common.collect.ImmutableList;
11 import org.eclipse.jdt.annotation.NonNull;
12 import org.opendaylight.yangtools.concepts.Immutable;
13 import org.opendaylight.yangtools.rfc6241.model.api.GetFilterElementAttributesEffectiveStatement;
14 import org.opendaylight.yangtools.rfc6241.model.api.GetFilterElementAttributesSchemaNode;
15 import org.opendaylight.yangtools.rfc6241.model.api.GetFilterElementAttributesStatement;
16 import org.opendaylight.yangtools.yang.common.Empty;
17 import org.opendaylight.yangtools.yang.common.QName;
18 import org.opendaylight.yangtools.yang.model.api.SchemaNodeDefaults;
19 import org.opendaylight.yangtools.yang.model.api.SchemaPath;
20 import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
21 import org.opendaylight.yangtools.yang.parser.rfc7950.stmt.UnknownEffectiveStatementBase;
22 import org.opendaylight.yangtools.yang.parser.spi.meta.EffectiveStmtCtx.Current;
23 import org.opendaylight.yangtools.yang.parser.spi.meta.SchemaPathSupport;
24
25 final class GetFilterElementAttributesEffectiveStatementImpl
26         extends UnknownEffectiveStatementBase<Empty, GetFilterElementAttributesStatement>
27         implements GetFilterElementAttributesEffectiveStatement, GetFilterElementAttributesSchemaNode {
28     private final @NonNull Immutable path;
29
30     GetFilterElementAttributesEffectiveStatementImpl(final Current<Empty, GetFilterElementAttributesStatement> stmt,
31             final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
32         super(stmt, substatements);
33         path = SchemaPathSupport.toEffectivePath(stmt.getEffectiveParent().getSchemaPath()
34                 .createChild(stmt.publicDefinition().getStatementName()));
35     }
36
37     @Override
38     public QName getQName() {
39         return SchemaNodeDefaults.extractQName(path);
40     }
41
42     @Override
43     @Deprecated
44     public SchemaPath getPath() {
45         return SchemaNodeDefaults.extractPath(this, path);
46     }
47
48     @Override
49     public GetFilterElementAttributesEffectiveStatement asEffectiveStatement() {
50         return this;
51     }
52 }