Generate compatibility constructors for Uint wrapped types
[mdsal.git] / binding / mdsal-binding-java-api-generator / src / main / java / org / opendaylight / mdsal / binding / java / api / generator / ClassTemplate.xtend
index 3bc5fa6abf50801f06b4fc4ea9ca370dc18f9c86..c4b36f694ebfac645b1f8faa257829bb9946fbd4 100644 (file)
@@ -261,6 +261,21 @@ class ClassTemplate extends BaseTemplate {
             «ENDIF»
         «ENDFOR»
     }
+    «val propType = allProperties.get(0).returnType»
+    «val uintType = UINT_TYPES.get(propType)»
+    «IF uintType !== null»
+
+        /**
+         * Utility migration constructor.
+         *
+         * @param value Wrapped value in legacy type
+         * @deprecated Use {#link «type.name»(«propType.importedName»)} instead.
+         */
+        @Deprecated(forRemoval = true)
+        public «type.getName»(final «uintType.importedName» value) {
+            this(«CodeHelpers.importedName».compatUint(value));
+        }
+    «ENDIF»
     '''
 
     def protected genUnionConstructor() '''