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;
14 final class CamelCaseWithNamespaceNamingStrategy extends ClassNamingStrategy {
15 private final CamelCaseNamingStrategy delegate;
17 CamelCaseWithNamespaceNamingStrategy(final CamelCaseNamingStrategy delegate) {
18 this.delegate = requireNonNull(delegate);
22 String simpleClassName() {
23 return delegate.namespace().appendSuffix(delegate.simpleClassName());
27 ClassNamingStrategy fallback() {
28 // FIXME: MDSAL-503: add a BijectiveNamingStrategy
29 // The algorithm needs to essentially fall back to using escape-based translation scheme, where each
30 // localName results in a unique name, while not conflicting with any possible preferredName. The exact
31 // mechanics for that are TBD. A requirement for that mapping is that it must not rely on definition
34 // But there is another possible step: since we are assigning 14 different statements into the default
35 // namespace (which did not add a suffix), we can try to assign a statement-derived suffix. To make
36 // things easier, we use two-characters: AC, AD, AU, AX, CA, CH, CO, IP, LE, LI, LL, NO, OP, RP.
42 return delegate.rootName();
46 String childPackage() {
47 return delegate.childPackage();
51 ToStringHelper addToStringAttributes(final ToStringHelper helper) {
52 return helper.add("delegate", delegate);