Binding generator v2 - fix getter method name 96/61596/1
authorJie Han <han.jie@zte.com.cn>
Tue, 18 Jul 2017 11:18:26 +0000 (19:18 +0800)
committerJie Han <han.jie@zte.com.cn>
Mon, 14 Aug 2017 08:12:16 +0000 (16:12 +0800)
- for yang snippet:
  container cont {
    leaf class {
      type string;
    }
  }
  the leaf name was reserved, but the result of method normalizing "get_class"
  is "getClass", so here just let "get" append the result of class normalizing
  "class" which should be "ClassReservedKeyword" ,that would be "getClassReservedKeyword".

Change-Id: Ibee98a5d82145b1f39509d05da6923fae0cb19f9
Signed-off-by: Jie Han <han.jie@zte.com.cn>
(cherry picked from commit f1ccafdea3ef03ef82f5e9f141b94ab2418d0d94)

binding2/mdsal-binding2-generator-impl/src/main/java/org/opendaylight/mdsal/binding/javav2/generator/impl/AuxiliaryGenUtils.java

index b5e881bf6bd5072a54981db16536f901de1afa32..e77164a7d6da7436cd4ba2a3b5882c4447dbd20e 100644 (file)
@@ -162,9 +162,7 @@ final class AuxiliaryGenUtils {
         } else {
             method.append("get");
         }
-        // underscore used as separator for distinction of method parts in convertIdentifier()
-        method.append('_').append(localName);
-        return JavaIdentifierNormalizer.normalizeSpecificIdentifier(method.toString(), JavaIdentifier.METHOD);
+        return method.append(JavaIdentifierNormalizer.normalizeSpecificIdentifier(localName, JavaIdentifier.CLASS)).toString();
     }
 
     static String createDescription(final SchemaNode schemaNode, final String fullyQualifiedName,