Deprecate BindingRuntimeContext.getEnumMapping() 03/87903/1
authorRobert Varga <robert.varga@pantheon.tech>
Mon, 17 Feb 2020 22:36:15 +0000 (23:36 +0100)
committerRobert Varga <robert.varga@pantheon.tech>
Wed, 19 Feb 2020 09:02:58 +0000 (10:02 +0100)
Generated enumerations capture their YANG-declared name and expose
it as their method.

JIRA: MDSAL-392
Change-Id: Iac16b6b3599565f059332ed079c432c0603ac500
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
binding/mdsal-binding-generator-impl/src/main/java/org/opendaylight/mdsal/binding/generator/util/BindingRuntimeContext.java

index dc2be63654c51fae21ba35f6c892dab8ae01ee2d..400bed420f47e41622e7d7142e6a187b92688aee 100644 (file)
@@ -47,6 +47,7 @@ import org.opendaylight.mdsal.binding.spec.naming.BindingMapping;
 import org.opendaylight.yangtools.concepts.Immutable;
 import org.opendaylight.yangtools.yang.binding.Action;
 import org.opendaylight.yangtools.yang.binding.Augmentation;
+import org.opendaylight.yangtools.yang.binding.Enumeration;
 import org.opendaylight.yangtools.yang.common.QName;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.AugmentationIdentifier;
 import org.opendaylight.yangtools.yang.model.api.ActionDefinition;
@@ -310,7 +311,9 @@ public final class BindingRuntimeContext implements Immutable {
      *
      * @param enumClass enum generated class
      * @return mapped enum constants from yang with their corresponding values in generated binding classes
+     * @deprecated This method is not guaranteed to be accurate. Use {@link Enumeration#getName()} instead.
      */
+    @Deprecated
     public BiMap<String, String> getEnumMapping(final Class<?> enumClass) {
         final Entry<GeneratedType, WithStatus> typeWithSchema = getTypeWithSchema(enumClass);
         return getEnumMapping(typeWithSchema);
@@ -321,7 +324,9 @@ public final class BindingRuntimeContext implements Immutable {
      *
      * @param enumClassName enum generated class name
      * @return mapped enum constants from yang with their corresponding values in generated binding classes
+     * @deprecated This method is not guaranteed to be accurate. Use {@link Enumeration#getName()} instead.
      */
+    @Deprecated
     public BiMap<String, String> getEnumMapping(final String enumClassName) {
         return getEnumMapping(findTypeWithSchema(enumClassName));
     }