X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=controller.git;a=blobdiff_plain;f=opendaylight%2Fsal%2Fyang-prototype%2Fcode-generator%2Fbinding-java-api-generator%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fsal%2Fjava%2Fapi%2Fgenerator%2FGeneratorUtil.java;h=93cc9a25f5e46167361713089085cc6f3cc1351d;hp=b4387fe8034b19b3d9856a84791f4f265d7e0cd3;hb=071db48e47fa3dd83da3933f1b35c3ca0d42f550;hpb=184e4f61d034f6c83da75de288d4f56ec48f60bf diff --git a/opendaylight/sal/yang-prototype/code-generator/binding-java-api-generator/src/main/java/org/opendaylight/controller/sal/java/api/generator/GeneratorUtil.java b/opendaylight/sal/yang-prototype/code-generator/binding-java-api-generator/src/main/java/org/opendaylight/controller/sal/java/api/generator/GeneratorUtil.java index b4387fe803..93cc9a25f5 100644 --- a/opendaylight/sal/yang-prototype/code-generator/binding-java-api-generator/src/main/java/org/opendaylight/controller/sal/java/api/generator/GeneratorUtil.java +++ b/opendaylight/sal/yang-prototype/code-generator/binding-java-api-generator/src/main/java/org/opendaylight/controller/sal/java/api/generator/GeneratorUtil.java @@ -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 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 annotations) { + private static StringBuilder appendAnnotations(final StringBuilder builder, + final List 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 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);