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.Utils;
21 import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.effective.DescriptionEffectiveStatementImpl;
22 import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.effective.EffectiveStatementBase;
23 import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.effective.ReferenceEffectiveStatementImpl;
24 import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.effective.StatusEffectiveStatementImpl;
25 import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.effective.ValueEffectiveStatementImpl;
27 public class EnumEffectiveStatementImpl extends EffectiveStatementBase<String, EnumStatement> implements EnumPair {
28 private final SchemaPath path;
29 private String description;
30 private String reference;
31 private Status status;
32 private Integer value;
34 public EnumEffectiveStatementImpl(final StmtContext<String, EnumStatement, ?> ctx) {
37 path = Utils.getSchemaPath(ctx);
39 for (final EffectiveStatement<?,?> effectiveStatement : effectiveSubstatements()) {
40 if (effectiveStatement instanceof DescriptionEffectiveStatementImpl) {
41 description = ((DescriptionEffectiveStatementImpl) effectiveStatement).argument();
43 if (effectiveStatement instanceof ReferenceEffectiveStatementImpl) {
44 reference = ((ReferenceEffectiveStatementImpl) effectiveStatement).argument();
46 if (effectiveStatement instanceof StatusEffectiveStatementImpl) {
47 status = ((StatusEffectiveStatementImpl) effectiveStatement).argument();
49 if (effectiveStatement instanceof ValueEffectiveStatementImpl) {
50 value = ((ValueEffectiveStatementImpl) effectiveStatement).argument();
56 public String getName() {
61 public Integer getValue() {
66 public QName getQName() {
67 return getPath().getLastComponent();
71 public SchemaPath getPath() {
76 public List<UnknownSchemaNode> getUnknownSchemaNodes() {
77 return Collections.emptyList();
81 public String getDescription() {
86 public String getReference() {
91 public Status getStatus() {