Speed up check for list 06/86606/1
authorRobert Varga <robert.varga@pantheon.tech>
Thu, 19 Dec 2019 14:42:41 +0000 (15:42 +0100)
committerRobert Varga <nite@hq.sk>
Sat, 28 Dec 2019 19:46:04 +0000 (19:46 +0000)
This speeds up the check for list by first checking if key is not
null and searching for interface afterwards.

Change-Id: Id35da9d5dfc76f243fd7c800115c26a2d181558b
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 28423fa5964abe10e3950dd1e42052aafa9989d0)

binding/mdsal-binding-java-api-generator/src/main/java/org/opendaylight/mdsal/binding/java/api/generator/AbstractBuilderTemplate.xtend

index 030bdacbde0af01dc8d319c0a507579956f39358..5f6a0f949e14f04f4d597ee7a7eead7b1c7f19c1 100644 (file)
@@ -130,8 +130,7 @@ abstract class AbstractBuilderTemplate extends BaseTemplate {
                 «generateCopyAugmentation(implType)»
             «ENDIF»
             «val allProps = new ArrayList(properties)»
-            «val isList = implementsIfc(targetType, BindingTypes.identifiable(targetType))»
-            «IF isList && keyType !== null»
+            «IF keyType !== null && implementsIfc(targetType, BindingTypes.identifiable(targetType))»
                 «val keyProps = new ArrayList((keyType as GeneratedTransferObject).properties)»
                 «keyProps.sort(KEY_PROPS_COMPARATOR)»
                 «FOR field : keyProps»