Bug 4301: Incorrect union generated code when using decimal64
authorMartin Ciglan <mciglan@cisco.com>
Tue, 22 Sep 2015 12:51:25 +0000 (14:51 +0200)
committerAnil Belur <abelur@linuxfoundation.org>
Wed, 19 Jun 2024 00:41:18 +0000 (10:41 +1000)
Binding Java API Generator shouldn't generate getValue() method
for java.math BigDecimal & BigInteger types, representing
YANG decimal64 & uint64 types.

This is just a port from yangtools.

Change-Id: I8f50003296d1004f9799c96950f49b4a38732137
Signed-off-by: Martin Ciglan <mciglan@cisco.com>
binding/mdsal-binding-java-api-generator/src/main/java/org/opendaylight/yangtools/sal/java/api/generator/UnionTemplate.xtend

index 78c2cd05253179c4bd7b3cc5b7329ef87e2509b8..e65fa9fcf5cf95c73238ba4b0bd003b1dbfe8c6b 100644 (file)
@@ -76,8 +76,10 @@ class UnionTemplate extends ClassTemplate {
                                 «ELSEIF "byte[]".equals(propRet.name)»
                                     ««« type binary
                                     this.«other.fieldName» = new «String.importedName»(«property.fieldName»).toCharArray();
-                                «ELSEIF propRet.fullyQualifiedName.startsWith("java.lang") || propRet instanceof Enumeration»
-                                    ««« type int*, uint or enumeration*
+                                «ELSEIF propRet.fullyQualifiedName.startsWith("java.lang")
+                                    || propRet instanceof Enumeration
+                                    || propRet.fullyQualifiedName.startsWith("java.math")»
+                                    ««« type int*, uint, decimal64 or enumeration*
                                     this.«other.fieldName» = «property.fieldName».toString().toCharArray();
                                 «ELSEIF propRet instanceof GeneratedTransferObject && (propRet as GeneratedTransferObject).unionType»
                                     ««« union type