Added generation of Transfer Objects from Type Definitions.
[controller.git] / opendaylight / sal / yang-prototype / code-generator / binding-java-api-generator / src / main / java / org / opendaylight / controller / sal / java / api / generator / GeneratorUtil.java
index b4387fe8034b19b3d9856a84791f4f265d7e0cd3..93cc9a25f5e46167361713089085cc6f3cc1351d 100644 (file)
@@ -27,6 +27,7 @@ import static org.opendaylight.controller.sal.java.api.generator.Constants.TAB;
 
 import java.util.List;
 
+import org.opendaylight.controller.binding.generator.util.BindingGeneratorUtil;
 import org.opendaylight.controller.sal.binding.model.api.AnnotationType;
 import org.opendaylight.controller.sal.binding.model.api.Constant;
 import org.opendaylight.controller.sal.binding.model.api.Enumeration;
@@ -61,7 +62,8 @@ public class GeneratorUtil {
         builder.append(PKG + GAP + genType.getPackageName() + SC);
         builder.append(NL);
         builder.append(NL);
-
+        createComment(builder, genType.getComment(), indent);
+        
         if (!genType.getAnnotations().isEmpty()) {
             final List<AnnotationType> annotations = genType.getAnnotations();
             appendAnnotations(builder, annotations);
@@ -72,7 +74,8 @@ public class GeneratorUtil {
         return builder.toString();
     }
 
-    private static StringBuilder appendAnnotations(final StringBuilder builder, final List<AnnotationType> annotations) {
+    private static StringBuilder appendAnnotations(final StringBuilder builder,
+            final List<AnnotationType> annotations) {
         if ((builder != null) && (annotations != null)) {
             for (final AnnotationType annotation : annotations) {
                 builder.append("@");
@@ -171,13 +174,13 @@ public class GeneratorUtil {
         createComment(builder, comment, indent);
         builder.append(NL);
         builder.append(indent);
-        
+
         if (!method.getAnnotations().isEmpty()) {
             final List<AnnotationType> annotations = method.getAnnotations();
             appendAnnotations(builder, annotations);
             builder.append(NL);
         }
-        
+
         builder.append(indent + getExplicitType(type) + GAP + name);
         builder.append(LB);
         for (int i = 0; i < parameters.size(); i++) {
@@ -186,7 +189,8 @@ public class GeneratorUtil {
             if (i + 1 == parameters.size()) {
                 separator = "";
             }
-            builder.append(getExplicitType(p.getType()) + GAP + p.getName()
+            builder.append(getExplicitType(p.getType()) + GAP
+                    + BindingGeneratorUtil.validateParameterName(p.getName())
                     + separator);
         }
         builder.append(RB);