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 java.util.Objects.requireNonNull;
12 import com.google.common.base.MoreObjects.ToStringHelper;
13 import org.opendaylight.yangtools.yang.common.AbstractQName;
15 final class AppendNamespaceNamingStrategy extends ClassNamingStrategy {
16 private final AbstractNamespacedNamingStrategy delegate;
18 AppendNamespaceNamingStrategy(final AbstractNamespacedNamingStrategy delegate) {
19 this.delegate = requireNonNull(delegate);
23 AbstractQName nodeIdentifier() {
24 return delegate.nodeIdentifier();
28 String simpleClassName() {
29 return delegate.namespace().appendSuffix(delegate.simpleClassName());
33 ClassNamingStrategy fallback() {
34 // FIXME: MDSAL-503: add a BijectiveNamingStrategy
35 // The algorithm needs to essentially fall back to using escape-based translation scheme, where each
36 // localName results in a unique name, while not conflicting with any possible preferredName. The exact
37 // mechanics for that are TBD. A requirement for that mapping is that it must not rely on definition
40 // But there is another possible step: since we are assigning 14 different statements into the default
41 // namespace (which did not add a suffix), we can try to assign a statement-derived suffix. To make
42 // things easier, we use two-characters: AC, AD, AU, AX, CA, CH, CO, IP, LE, LI, LL, NO, OP, RP.
47 ToStringHelper addToStringAttributes(final ToStringHelper helper) {
48 return helper.add("delegate", delegate);