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.model.api.Status;
13 import org.opendaylight.yangtools.yang.model.api.UnknownSchemaNode;
14 import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
15 import org.opendaylight.yangtools.yang.model.api.stmt.EnumStatement;
16 import org.opendaylight.yangtools.yang.model.api.type.EnumTypeDefinition.EnumPair;
17 import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
18 import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.effective.DeclaredEffectiveStatementBase;
19 import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.effective.DescriptionEffectiveStatementImpl;
20 import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.effective.ReferenceEffectiveStatementImpl;
21 import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.effective.StatusEffectiveStatementImpl;
22 import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.effective.ValueEffectiveStatementImpl;
24 public class EnumEffectiveStatementImpl extends DeclaredEffectiveStatementBase<String, EnumStatement> implements EnumPair {
25 private final String name;
26 private String description;
27 private String reference;
28 private Status status = Status.CURRENT;
29 private Integer value;
31 public EnumEffectiveStatementImpl(final StmtContext<String, EnumStatement, ?> ctx) {
34 name = ctx.rawStatementArgument();
36 for (final EffectiveStatement<?, ?> effectiveStatement : effectiveSubstatements()) {
37 if (effectiveStatement instanceof DescriptionEffectiveStatementImpl) {
38 description = ((DescriptionEffectiveStatementImpl) effectiveStatement).argument();
40 if (effectiveStatement instanceof ReferenceEffectiveStatementImpl) {
41 reference = ((ReferenceEffectiveStatementImpl) effectiveStatement).argument();
43 if (effectiveStatement instanceof StatusEffectiveStatementImpl) {
44 status = ((StatusEffectiveStatementImpl) effectiveStatement).argument();
46 if (effectiveStatement instanceof ValueEffectiveStatementImpl) {
47 value = ((ValueEffectiveStatementImpl) effectiveStatement).argument();
53 public String getName() {
58 public Integer getValue() {
63 public List<UnknownSchemaNode> getUnknownSchemaNodes() {
64 return Collections.emptyList();
68 public String getDescription() {
73 public String getReference() {
78 public Status getStatus() {