private static void generateFactoryMethodJavadoc(JMethod method, RecordTemplate schema)
{
StringBuilder docString = new StringBuilder();
if(schema.data().containsKey("annotations"))
{
DataMap annotations = schema.data().getDataMap("annotations");
if(annotations.containsKey("testMethod"))
{
DataMap testMethod = annotations.getDataMap("testMethod");
docString.append("<b>Test Method");
String testMethodDoc = testMethod.getString("doc");
if(testMethodDoc != null)
{
docString.append(": ");
docString.append(testMethodDoc);
}
docString.append("</b>\n");
}
}
final String doc = schema.data().getString("doc");
if (doc != null)
{
docString.append(doc);
}
if(docString.length() > 0)
{
method.javadoc().append(docString.toString());
method.javadoc().addReturn().add("builder for the resource method");
}
if(schema.data().containsKey("annotations"))
{
DataMap annotations = schema.data().getDataMap("annotations");
if(annotations.containsKey(ResourceModelEncoder.DEPRECATED_ANNOTATION_NAME))
{
method.annotate(Deprecated.class);
DataMap deprecated = annotations.getDataMap(ResourceModelEncoder.DEPRECATED_ANNOTATION_NAME);
if(deprecated.containsKey(ResourceModelEncoder.DEPRECATED_ANNOTATION_DOC_FIELD))
{
method.javadoc().addDeprecated().append(deprecated.getString(ResourceModelEncoder.DEPRECATED_ANNOTATION_DOC_FIELD));
}
}
}
}