Skip to content

Commit

Permalink
[Java] Generate javadoc for group encode properties as part of Issues #…
Browse files Browse the repository at this point in the history
…22 and #289.
  • Loading branch information
mjpt777 committed Oct 31, 2017
1 parent 3c07ba1 commit 9a59ca3
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -633,11 +633,13 @@ private CharSequence generateGroupEncoderProperty(final String groupName, final

sb.append(String.format(
"\n" +
indent + " public %1$s %2$sCount(final int count)\n" +
"%1$s" +
indent + " public %2$s %3$sCount(final int count)\n" +
indent + " {\n" +
indent + " %2$s.wrap(parentMessage, buffer, count);\n" +
indent + " return %2$s;\n" +
indent + " %3$s.wrap(parentMessage, buffer, count);\n" +
indent + " return %3$s;\n" +
indent + " }\n",
generateGroupEncodePropertyJavadoc(indent + INDENT, token, className),
className,
propertyName));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@ public static String generateOptionEncodeJavadoc(final String indent, final Toke
}

/**
* Generate the Javadoc comment header for a bitset choice option decode method.
* Generate the Javadoc comment header for flyweight property.
*
* @param indent level for the comment.
* @param propertyToken for the property name.
Expand All @@ -341,4 +341,30 @@ public static String generateFlyweightPropertyJavadoc(
indent + " * @return " + typeName + " : " + description + "\n" +
indent + " */\n";
}

/**
* Generate the Javadoc comment header for group encode property.
*
* @param indent level for the comment.
* @param propertyToken for the property name.
* @param typeName for the property type.
* @return a string representation of the Javadoc comment.
*/
public static String generateGroupEncodePropertyJavadoc(
final String indent, final Token propertyToken, final String typeName)
{
final String description = propertyToken.description();
if (null == description || description.isEmpty())
{
return "";
}

return
indent + "/**\n" +
indent + " * " + description + "\n" +
indent + " *\n" +
indent + " * @param count of times the group will be encoded\n" +
indent + " * @return " + typeName + " : encoder for the group\n" +
indent + " */\n";
}
}

0 comments on commit 9a59ca3

Please sign in to comment.