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.TypeStatement;
14 import org.opendaylight.yangtools.yang.parser.spi.SubstatementValidator;
15 import org.opendaylight.yangtools.yang.parser.spi.meta.AbstractDeclaredStatement;
16 import org.opendaylight.yangtools.yang.parser.spi.meta.AbstractStatementSupport;
17 import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
18 import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.effective.type.UnionSpecificationEffectiveStatementImpl;
20 public class UnionSpecificationImpl extends AbstractDeclaredStatement<String>
21 implements TypeStatement.UnionSpecification {
22 private static final SubstatementValidator SUBSTATEMENT_VALIDATOR = SubstatementValidator.builder(Rfc6020Mapping
24 .addMultiple(Rfc6020Mapping.TYPE)
27 protected UnionSpecificationImpl(
28 final StmtContext<String, TypeStatement.UnionSpecification, ?> context) {
32 public static class Definition extends AbstractStatementSupport<String, TypeStatement.UnionSpecification, EffectiveStatement<String, TypeStatement.UnionSpecification>> {
35 super(Rfc6020Mapping.TYPE);
39 public String parseArgumentValue(final StmtContext<?, ?, ?> ctx, final String value) {
44 public TypeStatement.UnionSpecification createDeclared(
45 final StmtContext<String, TypeStatement.UnionSpecification, ?> ctx) {
46 return new UnionSpecificationImpl(ctx);
50 public EffectiveStatement<String, TypeStatement.UnionSpecification> createEffective(
51 final StmtContext<String, TypeStatement.UnionSpecification, EffectiveStatement<String, TypeStatement.UnionSpecification>> ctx) {
52 return new UnionSpecificationEffectiveStatementImpl(ctx);
56 public void onFullDefinitionDeclared(final StmtContext.Mutable<String, UnionSpecification, EffectiveStatement<String, UnionSpecification>> stmt) {
57 super.onFullDefinitionDeclared(stmt);
58 SUBSTATEMENT_VALIDATOR.validate(stmt);
63 public String getName() {
68 public Collection<? extends TypeStatement> getTypes() {
69 return allDeclared(TypeStatement.class);