use of spoon.reflect.code.CtJavaDocTag in project spoon by INRIA.
the class CodeFactory method createJavaDocTag.
/**
* Creates a javadoc tag
*
* @param content The content of the javadoc tag with a possible paramater
* @param type The tag type
* @return a new CtJavaDocTag
*/
public CtJavaDocTag createJavaDocTag(String content, CtJavaDocTag.TagType type) {
if (content == null) {
content = "";
}
CtJavaDocTag docTag = factory.Core().createJavaDocTag();
if (type != null && type.hasParam()) {
int firstWord = content.indexOf(" ");
int firstLine = content.indexOf("\n");
if (firstLine < firstWord && firstLine >= 0) {
firstWord = firstLine;
}
if (firstWord == -1) {
firstWord = content.length();
}
String param = content.substring(0, firstWord);
content = content.substring(firstWord);
docTag.setParam(param);
}
return docTag.setContent(content.trim()).setType(type);
}
Aggregations