我有这样的枚举:
public enum Type{
A("Title A"),
B("Title B"),
C("Title C"),
D("Title D");
private String title;
private Relation(String title) {
this.title = title;
}
public String getTitle() {
return title;
}
}
我将Title.D作为类型添加到freemarker,我怎样才能访问getTitle方法? 我试过type.title& type.getTitle(),都不起作用。 有人可以帮忙吗? THX!
答案 0 :(得分:1)
Yuxuan的评论暗示这个问题已经通过在项目中升级到Freemarker的新版本来解决。我的假设是相关版本是Freemarker 2.3.9。这里添加了JDK1.5枚举支持。