【代碼
public class EnumGenArgInfo
{
private Set<String> items;
private String className;
private String packageName;
public String getPackageName()
{
return packageName;
}
public void setPackageName(String packageName)
{
this
}
public String getClassName()
{
return className;
}
public void setClassName(String className)
{
this
}
public Set<String> getItems()
{
return items;
}
public void setItems(Set<String> items)
{
this
}
}
接下來我們來寫模板文件
【代碼
<%@ jet package=
class=
imports=
%>
<%
EnumGenArgInfo argInfo = (EnumGenArgInfo)argument;
Set<String> enumItems = argInfo
String className = argInfo
String packageName = argInfo
%>
package <%=packageName%>;
public class <%=className%>
{
private String type;
<%for(String item:enumItems){%>
public <%=className%> <%=item%> = new <%=className%>(
<%}%>
right
From:http://tw.wingwit.com/Article/program/Java/ky/201311/29011.html