我正在为 Jira 编写一个插件,我需要添加自定义计算列来发布导航器。该栏应显示最后发表的评论。但在此列中的问题导航器值类似于“ClassName@123456”,而不是评论的正文。我应该怎么做才能将评论的正文返回到此列?
到目前为止的代码:
public class LastCommentField extends CalculatedCFType {
private CommentManager commentManager = null;
public LastCommentField(CommentManager commentManager) {
this.commentManager=commentManager;
}
public Object getValueFromIssue(CustomField field, Issue issue) {
Comment lastComment=null;
List<Comment> comments = commentManager.getComments(issue);
if(comments != null && !comments.isEmpty()) {
lastComment = (Comment)comments.get(comments.size() - 1);
}
return lastComment;
}
public String getStringFromSingularObject (Object object) {
return object.toString();
}
public Object getSingularObjectFromString(String value) {
return value;
}
}