2 * Copyright (c) 2017 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.rfc7950;
10 import com.google.common.annotations.Beta;
11 import com.google.common.collect.ImmutableMap;
13 import org.opendaylight.yangtools.yang.parser.spi.meta.StatementSupport;
14 import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.TypeStatementImpl;
15 import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.TypeUtils;
18 * Class providing necessary support for processing YANG 1.1 Type statement.
21 public final class TypeStatementRfc7950Support extends TypeStatementImpl.Definition {
22 private static final Map<String, StatementSupport<?, ?, ?>> ARGUMENT_SPECIFIC_SUPPORTS =
23 ImmutableMap.<String, StatementSupport<?, ?, ?>>of(
24 TypeUtils.LEAF_REF, new LeafrefSpecificationRfc7950Support(),
25 TypeUtils.IDENTITY_REF, new IdentityrefSpecificationRfc7950Support());
28 public boolean hasArgumentSpecificSupports() {
29 return !ARGUMENT_SPECIFIC_SUPPORTS.isEmpty() || super.hasArgumentSpecificSupports();
33 public StatementSupport<?, ?, ?> getSupportSpecificForArgument(final String argument) {
34 final StatementSupport<?, ?, ?> potential = ARGUMENT_SPECIFIC_SUPPORTS.get(argument);
35 return potential != null ? potential : super.getSupportSpecificForArgument(argument);