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.type;
10 import java.util.Collections;
11 import java.util.List;
12 import org.opendaylight.yangtools.yang.common.QName;
13 import org.opendaylight.yangtools.yang.model.api.SchemaPath;
14 import org.opendaylight.yangtools.yang.model.api.Status;
15 import org.opendaylight.yangtools.yang.model.api.UnknownSchemaNode;
16 import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
17 import org.opendaylight.yangtools.yang.model.api.stmt.EnumStatement;
18 import org.opendaylight.yangtools.yang.model.api.type.EnumTypeDefinition.EnumPair;
19 import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
20 import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.effective.DeclaredEffectiveStatementBase;
21 import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.effective.DescriptionEffectiveStatementImpl;
22 import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.effective.ReferenceEffectiveStatementImpl;
23 import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.effective.StatusEffectiveStatementImpl;
24 import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.effective.ValueEffectiveStatementImpl;
26 public class EnumEffectiveStatementImpl extends DeclaredEffectiveStatementBase<String, EnumStatement> implements EnumPair {
27 private final SchemaPath path;
28 private String description;
29 private String reference;
30 private Status status;
31 private Integer value;
33 public EnumEffectiveStatementImpl(final StmtContext<String, EnumStatement, ?> ctx) {
36 path = ctx.getSchemaPath().get();
38 for (final EffectiveStatement<?,?> effectiveStatement : effectiveSubstatements()) {
39 if (effectiveStatement instanceof DescriptionEffectiveStatementImpl) {
40 description = ((DescriptionEffectiveStatementImpl) effectiveStatement).argument();
42 if (effectiveStatement instanceof ReferenceEffectiveStatementImpl) {
43 reference = ((ReferenceEffectiveStatementImpl) effectiveStatement).argument();
45 if (effectiveStatement instanceof StatusEffectiveStatementImpl) {
46 status = ((StatusEffectiveStatementImpl) effectiveStatement).argument();
48 if (effectiveStatement instanceof ValueEffectiveStatementImpl) {
49 value = ((ValueEffectiveStatementImpl) effectiveStatement).argument();
55 public String getName() {
60 public Integer getValue() {
65 public QName getQName() {
66 return getPath().getLastComponent();
70 public SchemaPath getPath() {
75 public List<UnknownSchemaNode> getUnknownSchemaNodes() {
76 return Collections.emptyList();
80 public String getDescription() {
85 public String getReference() {
90 public Status getStatus() {