e6a77c7d50183a106d62c005c9d7645f3badb9d2
[yangtools.git] / yang / yang-parser-impl / src / main / java / org / opendaylight / yangtools / yang / parser / rfc7950 / stmt / type / TypeStatementRFC7950Support.java
1 /*
2  * Copyright (c) 2017 Cisco Systems, Inc. and others.  All rights reserved.
3  *
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
7  */
8 package org.opendaylight.yangtools.yang.parser.rfc7950.stmt.type;
9
10 import com.google.common.annotations.Beta;
11 import com.google.common.collect.ImmutableMap;
12 import java.util.Map;
13 import org.opendaylight.yangtools.yang.parser.spi.meta.StatementSupport;
14
15 /**
16  * Class providing necessary support for processing YANG 1.1 Type statement.
17  */
18 @Beta
19 public final class TypeStatementRFC7950Support extends AbstractTypeStatementSupport {
20     private static final Map<String, StatementSupport<?, ?, ?>> ARGUMENT_SPECIFIC_SUPPORTS = ImmutableMap.of(
21         LEAF_REF, new LeafrefSpecificationRFC7950Support(),
22         IDENTITY_REF, new IdentityrefSpecificationRFC7950Support());
23
24     @Override
25     public boolean hasArgumentSpecificSupports() {
26         return !ARGUMENT_SPECIFIC_SUPPORTS.isEmpty() || super.hasArgumentSpecificSupports();
27     }
28
29     @Override
30     public StatementSupport<?, ?, ?> getSupportSpecificForArgument(final String argument) {
31         final StatementSupport<?, ?, ?> potential = ARGUMENT_SPECIFIC_SUPPORTS.get(argument);
32         return potential != null ? potential : super.getSupportSpecificForArgument(argument);
33     }
34 }