import org.opendaylight.yangtools.yang.binding.Augmentable;
import org.opendaylight.yangtools.yang.binding.DataContainer;
import org.opendaylight.yangtools.yang.binding.Identifiable;
+import org.opendaylight.yangtools.yang.binding.ScalarTypeObject;
import org.opendaylight.yangtools.yang.common.QName;
import org.opendaylight.yangtools.yang.common.QNameModule;
import org.opendaylight.yangtools.yang.common.Revision;
*/
public static final @NonNull String DATA_CONTAINER_IMPLEMENTED_INTERFACE_NAME = "implementedInterface";
+ /**
+ * Name of default {@link Object#hashCode()} implementation for instantiated DataObjects. Each such generated
+ * interface contains this static method.
+ */
+ public static final @NonNull String BINDING_HASHCODE_NAME = "bindingHashCode";
+
+ /**
+ * Name of default {@link Object#equals(Object)} implementation for instantiated DataObjects. Each such generated
+ * interface contains this static method.
+ */
+ public static final @NonNull String BINDING_EQUALS_NAME = "bindingEquals";
+
+ /**
+ * Name of default {@link Object#toString()} implementation for instantiated DataObjects. Each such generated
+ * interface contains this static method.
+ */
+ public static final @NonNull String BINDING_TO_STRING_NAME = "bindingToString";
+
+ /**
+ * Name of {@link ScalarTypeObject#getValue()}.
+ */
+ public static final @NonNull String SCALAR_TYPE_OBJECT_GET_VALUE_NAME = "getValue";
+
/**
* Prefix for getter methods working on top of boolean.
*/
private static final Interner<String> PACKAGE_INTERNER = Interners.newWeakInterner();
private BindingMapping() {
- throw new UnsupportedOperationException("Utility class should not be instantiated");
+ // Hidden on purpose
}
public static @NonNull String getRootPackageName(final QName module) {
return str.substring(0, 1).toLowerCase(Locale.ENGLISH) + str.substring(1);
}
+ /**
+ * Returns the {@link String} {@code s} with a '$' character as suffix.
+ *
+ * @param qname RPC QName
+ * @return The RPC method name as determined by considering the localname against the JLS.
+ * @throws NullPointerException if {@code qname} is null
+ */
+ public static @NonNull String getRpcMethodName(final @NonNull QName qname) {
+ final String methodName = getMethodName(qname);
+ return JAVA_RESERVED_WORDS.contains(methodName) ? methodName + "$" : methodName;
+ }
+
/**
* Returns Java identifiers, conforming to JLS9 Section 3.8 to use for specified YANG assigned names
* (RFC7950 Section 9.6.4). This method considers two distinct encodings: one the pre-Fluorine mapping, which is