Use ImmutableSet/Map in YangValidationBundles
[yangtools.git] / yang / yang-parser-impl / src / main / java / org / opendaylight / yangtools / yang / parser / stmt / rfc6020 / YangValidationBundles.java
1 /*
2  * Copyright (c) 2015 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.stmt.rfc6020;
9
10 import com.google.common.collect.ImmutableMap;
11 import com.google.common.collect.ImmutableMap.Builder;
12 import com.google.common.collect.ImmutableSet;
13 import java.util.Map;
14 import java.util.Set;
15 import org.opendaylight.yangtools.yang.model.api.Rfc6020Mapping;
16 import org.opendaylight.yangtools.yang.model.api.meta.StatementDefinition;
17
18 public final class YangValidationBundles {
19     private YangValidationBundles() {
20         throw new UnsupportedOperationException("Utility class");
21     }
22
23     public static final Set<StatementDefinition> SUPPORTED_REFINE_SUBSTATEMENTS = ImmutableSet.<StatementDefinition>of(
24         Rfc6020Mapping.DEFAULT, Rfc6020Mapping.DESCRIPTION, Rfc6020Mapping.REFERENCE, Rfc6020Mapping.CONFIG,
25         Rfc6020Mapping.MANDATORY, Rfc6020Mapping.MUST, Rfc6020Mapping.PRESENCE, Rfc6020Mapping.MIN_ELEMENTS,
26         Rfc6020Mapping.MAX_ELEMENTS);
27
28     public static final Map<StatementDefinition, Set<StatementDefinition>> SUPPORTED_REFINE_TARGETS;
29     static {
30         final Builder<StatementDefinition, Set<StatementDefinition>> b = ImmutableMap.builder();
31         b.put(Rfc6020Mapping.DEFAULT, ImmutableSet.<StatementDefinition>of(Rfc6020Mapping.LEAF, Rfc6020Mapping.CHOICE));
32         b.put(Rfc6020Mapping.MANDATORY, ImmutableSet.<StatementDefinition>of(
33                 Rfc6020Mapping.LEAF, Rfc6020Mapping.CHOICE, Rfc6020Mapping.ANYXML));
34         b.put(Rfc6020Mapping.PRESENCE, ImmutableSet.<StatementDefinition>of(Rfc6020Mapping.CONTAINER));
35         b.put(Rfc6020Mapping.MUST, ImmutableSet.<StatementDefinition>of(
36                 Rfc6020Mapping.CONTAINER, Rfc6020Mapping.LIST, Rfc6020Mapping.LEAF,
37                 Rfc6020Mapping.LEAF_LIST, Rfc6020Mapping.ANYXML));
38         b.put(Rfc6020Mapping.MIN_ELEMENTS, ImmutableSet.<StatementDefinition>of(
39                 Rfc6020Mapping.LIST, Rfc6020Mapping.LEAF_LIST));
40         b.put(Rfc6020Mapping.MAX_ELEMENTS, ImmutableSet.<StatementDefinition>of(
41                 Rfc6020Mapping.LIST, Rfc6020Mapping.LEAF_LIST));
42         SUPPORTED_REFINE_TARGETS = b.build();
43     }
44
45
46     public static final Set<StatementDefinition> SUPPORTED_AUGMENT_TARGETS = ImmutableSet.<StatementDefinition>of(
47         Rfc6020Mapping.CONTAINER, Rfc6020Mapping.LIST, Rfc6020Mapping.CASE, Rfc6020Mapping.INPUT, Rfc6020Mapping.OUTPUT,
48         Rfc6020Mapping.NOTIFICATION, Rfc6020Mapping.CHOICE, Rfc6020Mapping.RPC);
49
50     public static final Set<StatementDefinition> SUPPORTED_CASE_SHORTHANDS = ImmutableSet.<StatementDefinition>of(
51         Rfc6020Mapping.CONTAINER, Rfc6020Mapping.LIST, Rfc6020Mapping.LEAF, Rfc6020Mapping.LEAF_LIST,
52         Rfc6020Mapping.ANYXML);
53
54     public static final Set<StatementDefinition> SUPPORTED_DATA_NODES = ImmutableSet.<StatementDefinition>of(
55         Rfc6020Mapping.CONTAINER, Rfc6020Mapping.LIST, Rfc6020Mapping.LEAF, Rfc6020Mapping.LEAF_LIST,
56         Rfc6020Mapping.ANYXML);
57 }