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;
10 import java.util.Collection;
11 import org.opendaylight.yangtools.yang.model.api.Rfc6020Mapping;
12 import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
13 import org.opendaylight.yangtools.yang.model.api.stmt.EnumStatement;
14 import org.opendaylight.yangtools.yang.model.api.stmt.TypeStatement;
15 import org.opendaylight.yangtools.yang.parser.spi.SubstatementValidator;
16 import org.opendaylight.yangtools.yang.parser.spi.meta.AbstractDeclaredStatement;
17 import org.opendaylight.yangtools.yang.parser.spi.meta.AbstractStatementSupport;
18 import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
19 import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.effective.type.EnumSpecificationEffectiveStatementImpl;
21 public class EnumSpecificationImpl extends AbstractDeclaredStatement<String> implements TypeStatement.EnumSpecification {
22 private static final SubstatementValidator SUBSTATEMENT_VALIDATOR = SubstatementValidator.builder(Rfc6020Mapping
24 .addMultiple(Rfc6020Mapping.ENUM)
27 protected EnumSpecificationImpl(final StmtContext<String, TypeStatement.EnumSpecification, ?> context) {
31 public static class Definition
33 AbstractStatementSupport<String, TypeStatement.EnumSpecification, EffectiveStatement<String, TypeStatement.EnumSpecification>> {
36 super(Rfc6020Mapping.TYPE);
40 public String parseArgumentValue(final StmtContext<?, ?, ?> ctx, final String value) {
45 public TypeStatement.EnumSpecification createDeclared(
46 final StmtContext<String, TypeStatement.EnumSpecification, ?> ctx) {
47 return new EnumSpecificationImpl(ctx);
51 public EffectiveStatement<String, TypeStatement.EnumSpecification> createEffective(
52 final StmtContext<String, TypeStatement.EnumSpecification, EffectiveStatement<String, TypeStatement.EnumSpecification>> ctx) {
53 return new EnumSpecificationEffectiveStatementImpl(ctx);
57 public void onFullDefinitionDeclared(final StmtContext.Mutable<String, EnumSpecification,
58 EffectiveStatement<String, EnumSpecification>> stmt) {
59 super.onFullDefinitionDeclared(stmt);
60 SUBSTATEMENT_VALIDATOR.validate(stmt);
65 public String getName() {
70 public Collection<? extends EnumStatement> getEnums() {
71 return allDeclared(EnumStatement.class);