final StringBuilder buffer = new StringBuilder();
/// The deprecated block comes first.
//
final TextBlock deprecatedBlock = caldoc.getDeprecatedBlock();
if (deprecatedBlock != null) {
buffer.append("[").append(CALDocMessages.getString("deprecatedColon")).append("\n");
buffer.append(getTextFromCALDocTextBlockWithLeadingIndentAndTrailingNewline(deprecatedBlock, INDENT_LEVEL));
buffer.append("]\n\n");
}
/// If the entity is a class method, then display whether it is required or optional
//
if (envEntity instanceof ClassMethod) {
final ClassMethod method = (ClassMethod)envEntity;
buffer.append("\n");
if (method.getDefaultClassMethodName() == null) {
// no default - required
buffer.append(CALDocMessages.getString("requiredMethodIndicator"));
} else {
// has default - optional
buffer.append(CALDocMessages.getString("optionalMethodIndicator"));
}
buffer.append("\n\n");
}
/// The main description
//
buffer.append(getTextFromCALDocTextBlockWithLeadingIndentAndTrailingNewline(caldoc.getDescriptionBlock(), 0));
/// The arguments and the return value
//
buffer.append(getTextForArgumentsAndReturnValue(caldoc, envEntity, typeExpr, scopedEntityNamingPolicy));
/// The authors
//
final int nAuthors = caldoc.getNAuthorBlocks();
if (nAuthors > 0) {
buffer.append("\n").append(CALDocMessages.getString("authorColon")).append("\n");
for (int i = 0; i < nAuthors; i++) {
final TextBlock authorBlock = caldoc.getNthAuthorBlock(i);
buffer.append(getTextFromCALDocTextBlockWithLeadingIndentAndTrailingNewline(authorBlock, INDENT_LEVEL));
}
}
/// The version
//
final TextBlock versionBlock = caldoc.getVersionBlock();
if (versionBlock != null) {
buffer.append("\n").append(CALDocMessages.getString("versionColon")).append("\n");
buffer.append(getTextFromCALDocTextBlockWithLeadingIndentAndTrailingNewline(versionBlock, INDENT_LEVEL));
}