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 com.google.common.base.MoreObjects;
11 import com.google.common.base.MoreObjects.ToStringHelper;
12 import org.eclipse.jdt.annotation.NonNull;
13 import org.eclipse.jdt.annotation.Nullable;
14 import org.opendaylight.yangtools.concepts.Immutable;
17 * Enumeration of known strategies for translating a YANG node identifier into a Java package name segment or a Java
20 abstract class ClassNamingStrategy implements Immutable {
22 * Return the simple Java class name assigned by this naming strategy.
24 * @return Simple class name
26 abstract @NonNull String simpleClassName();
29 * Return the fallback naming strategy. The fallback is used if this strategy ends up being insufficient in
30 * assigning a unique name.
32 * @return Fallback strategy, {@code null} if there is no fallback.
34 abstract @Nullable ClassNamingStrategy fallback();
36 // FIXME: document this method
37 abstract @NonNull String rootName();
40 * Return the {@code Java package name} allocated for any classes generated as children of this strategy.
42 * @return A package fragment name, for example {@code "foo.bar.baz"}
44 abstract @NonNull String childPackage();
47 public final String toString() {
48 return addToStringAttributes(MoreObjects.toStringHelper(this)).toString();
51 abstract @NonNull ToStringHelper addToStringAttributes(@NonNull ToStringHelper helper);