Skip to content

Commit 9a59ca3

Browse files
committed
[Java] Generate javadoc for group encode properties as part of Issues #22 and #289.
1 parent 3c07ba1 commit 9a59ca3

File tree

2 files changed

+32
-4
lines changed

2 files changed

+32
-4
lines changed

sbe-tool/src/main/java/uk/co/real_logic/sbe/generation/java/JavaGenerator.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -633,11 +633,13 @@ private CharSequence generateGroupEncoderProperty(final String groupName, final
633633

634634
sb.append(String.format(
635635
"\n" +
636-
indent + " public %1$s %2$sCount(final int count)\n" +
636+
"%1$s" +
637+
indent + " public %2$s %3$sCount(final int count)\n" +
637638
indent + " {\n" +
638-
indent + " %2$s.wrap(parentMessage, buffer, count);\n" +
639-
indent + " return %2$s;\n" +
639+
indent + " %3$s.wrap(parentMessage, buffer, count);\n" +
640+
indent + " return %3$s;\n" +
640641
indent + " }\n",
642+
generateGroupEncodePropertyJavadoc(indent + INDENT, token, className),
641643
className,
642644
propertyName));
643645

sbe-tool/src/main/java/uk/co/real_logic/sbe/generation/java/JavaUtil.java

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,7 @@ public static String generateOptionEncodeJavadoc(final String indent, final Toke
318318
}
319319

320320
/**
321-
* Generate the Javadoc comment header for a bitset choice option decode method.
321+
* Generate the Javadoc comment header for flyweight property.
322322
*
323323
* @param indent level for the comment.
324324
* @param propertyToken for the property name.
@@ -341,4 +341,30 @@ public static String generateFlyweightPropertyJavadoc(
341341
indent + " * @return " + typeName + " : " + description + "\n" +
342342
indent + " */\n";
343343
}
344+
345+
/**
346+
* Generate the Javadoc comment header for group encode property.
347+
*
348+
* @param indent level for the comment.
349+
* @param propertyToken for the property name.
350+
* @param typeName for the property type.
351+
* @return a string representation of the Javadoc comment.
352+
*/
353+
public static String generateGroupEncodePropertyJavadoc(
354+
final String indent, final Token propertyToken, final String typeName)
355+
{
356+
final String description = propertyToken.description();
357+
if (null == description || description.isEmpty())
358+
{
359+
return "";
360+
}
361+
362+
return
363+
indent + "/**\n" +
364+
indent + " * " + description + "\n" +
365+
indent + " *\n" +
366+
indent + " * @param count of times the group will be encoded\n" +
367+
indent + " * @return " + typeName + " : encoder for the group\n" +
368+
indent + " */\n";
369+
}
344370
}

0 commit comments

Comments
 (0)