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<QName, EnumStatement> implements EnumPair {
28 private final QName qName;
29 private final SchemaPath path;
30 private String description;
31 private String reference;
32 private Status status;
33 private Integer value;
35 public EnumEffectiveStatementImpl(final StmtContext<QName, EnumStatement, ?> ctx) {
38 qName = ctx.getStatementArgument();
39 path = Utils.getSchemaPath(ctx);
41 for (final EffectiveStatement<?,?> effectiveStatement : effectiveSubstatements()) {
42 if (effectiveStatement instanceof DescriptionEffectiveStatementImpl) {
43 description = ((DescriptionEffectiveStatementImpl) effectiveStatement).argument();
45 if (effectiveStatement instanceof ReferenceEffectiveStatementImpl) {
46 reference = ((ReferenceEffectiveStatementImpl) effectiveStatement).argument();
48 if (effectiveStatement instanceof StatusEffectiveStatementImpl) {
49 status = ((StatusEffectiveStatementImpl) effectiveStatement).argument();
51 if (effectiveStatement instanceof ValueEffectiveStatementImpl) {
52 value = ((ValueEffectiveStatementImpl) effectiveStatement).argument();
58 public String getName() {
59 return qName.getLocalName();
63 public Integer getValue() {
68 public QName getQName() {
73 public SchemaPath getPath() {
78 public List<UnknownSchemaNode> getUnknownSchemaNodes() {
79 return Collections.emptyList();
83 public String getDescription() {
88 public String getReference() {
93 public Status getStatus() {