2 * Copyright (c) 2021 PANTHEON.tech, s.r.o. 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.mdsal.binding.generator.impl.reactor;
10 import static com.google.common.base.Verify.verify;
11 import static java.util.Objects.requireNonNull;
13 import org.eclipse.jdt.annotation.NonNull;
16 * <a href="https://www.rfc-editor.org/rfc/rfc6020#section-6.2.1">YANG statement namespaces</a> which we process.
18 // FIXME: move this to 'BindingNamespace' in binding-spec-util
19 enum StatementNamespace {
21 * The namespace of all {@code feature} statements, bullet 3.
25 * The namespace of all {@code identity} statements, bullet 4.
29 * The namespace of all {@code typedef} statements, bullet 5.
33 * The namespace of all {@code grouping} statements, bullet 6.
37 * The namespace of all RFC8040 {@code ietf-restconf:yang-data} statements. These sit outside of the usual YANG
38 * statement namespaces, but may overlap in the usual case when template names conform to YANG {@code identifier}
43 * The namespace for {@code augment} statements. These are specific to Java Binding.
51 CONTAINER("$CO", true),
55 LEAF_LIST("$LL", true),
57 * The namespace for a {@code list}'s {@code key} statement. This typically does not conflict, but could in case of
61 * list foo { // results Foo
62 * key bar; // triggers FooKey as a sibling to Foo
68 * container foo-key; // results in FooKey
72 * In this case the key-derived FooKey gets shifted to {@code $KE}.
75 NOTIFICATION("$NO", true),
79 * The namespace for a {@code module}'s data root interface. This typically does not conflict, but could in case of
82 * module foo { // results in FooData
83 * container foo-data; // results in FooData as well
87 * In this case the module-derived FooData gets shifted to {@code $D}.
89 DATA_ROOT("$D", true);
91 private final @NonNull String suffix;
92 private final boolean resistant;
94 StatementNamespace(final @NonNull String suffix) {
98 StatementNamespace(final @NonNull String suffix, final boolean resistant) {
99 verify(!suffix.isEmpty());
100 this.suffix = requireNonNull(suffix);
101 this.resistant = resistant;
104 @NonNull String suffix() {
108 boolean resistant() {