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;
15 import org.opendaylight.yangtools.yang.common.AbstractQName;
18 * Enumeration of known strategies for translating a YANG node identifier into a Java package name segment or a Java
21 abstract class ClassNamingStrategy implements Immutable {
23 * Return the YANG node identifier backing this naming strategy. Only the {@link AbstractQName#getLocalName()} part
24 * of the identifier is significant.
26 * @return YANG node identifier.
28 abstract @NonNull AbstractQName nodeIdentifier();
31 * Return the simple Java class name assigned by this naming strategy.
33 * @return Simple class name
35 abstract @NonNull String simpleClassName();
38 * Return the fallback naming strategy. The fallback is used if this strategy ends up being insufficient in
39 * assigning a unique name.
41 * @return Fallback strategy, {@code null} if there is no fallback.
43 abstract @Nullable ClassNamingStrategy fallback();
46 public final String toString() {
47 return addToStringAttributes(MoreObjects.toStringHelper(this)).toString();
50 abstract @NonNull ToStringHelper addToStringAttributes(@NonNull ToStringHelper helper);