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 static org.opendaylight.yangtools.yang.parser.spi.SubstatementValidator.MAX;
12 import java.util.Collection;
13 import org.opendaylight.yangtools.yang.model.api.Rfc6020Mapping;
14 import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
15 import org.opendaylight.yangtools.yang.model.api.stmt.TypeStatement;
16 import org.opendaylight.yangtools.yang.parser.spi.SubstatementValidator;
17 import org.opendaylight.yangtools.yang.parser.spi.meta.AbstractDeclaredStatement;
18 import org.opendaylight.yangtools.yang.parser.spi.meta.AbstractStatementSupport;
19 import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
20 import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.effective.type.UnionSpecificationEffectiveStatementImpl;
22 public class UnionSpecificationImpl extends AbstractDeclaredStatement<String>
23 implements TypeStatement.UnionSpecification {
24 private static final SubstatementValidator SUBSTATEMENT_VALIDATOR = SubstatementValidator.builder(Rfc6020Mapping
26 .add(Rfc6020Mapping.TYPE, 1, MAX)
29 protected UnionSpecificationImpl(
30 StmtContext<String, TypeStatement.UnionSpecification, ?> context) {
34 public static class Definition extends AbstractStatementSupport<String, TypeStatement.UnionSpecification, EffectiveStatement<String, TypeStatement.UnionSpecification>> {
37 super(Rfc6020Mapping.TYPE);
41 public String parseArgumentValue(StmtContext<?, ?, ?> ctx, String value) {
46 public TypeStatement.UnionSpecification createDeclared(
47 StmtContext<String, TypeStatement.UnionSpecification, ?> ctx) {
48 return new UnionSpecificationImpl(ctx);
52 public EffectiveStatement<String, TypeStatement.UnionSpecification> createEffective(
53 StmtContext<String, TypeStatement.UnionSpecification, EffectiveStatement<String, TypeStatement.UnionSpecification>> ctx) {
54 return new UnionSpecificationEffectiveStatementImpl(ctx);
58 public void onFullDefinitionDeclared(StmtContext.Mutable<String, UnionSpecification, EffectiveStatement<String, UnionSpecification>> stmt) {
59 super.onFullDefinitionDeclared(stmt);
60 SUBSTATEMENT_VALIDATOR.validate(stmt);
65 public String getName() {
70 public Collection<? extends TypeStatement> getTypes() {
71 return allDeclared(TypeStatement.class);