📄 enumcodegenerator.javajet
字号:
<%@ jet package="com.cownew.enumgenerator.wizards" class="EnumCodeGenerator"
imports="java.util.*"%>
<%
EnumGenArgInfo argInfo = (EnumGenArgInfo)argument;
Set<String> enumItems = argInfo.getItems();
String className = argInfo.getClassName();
String packageName = argInfo.getPackageName();
%>
package <%=packageName%>;
public class <%=className%>
{
private String type;
<%for(String item:enumItems){%>
public <%=className%> <%=item%> = new <%=className%>("<%=item%>");
<%}%>
private <%=className%>(String type)
{
super();
this.type = type;
}
public int hashCode()
{
final int PRIME = 31;
int result = 1;
result = PRIME * result + ((type == null) ? 0 : type.hashCode());
return result;
}
public boolean equals(Object obj)
{
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
final <%=className%> other = (<%=className%>) obj;
if (type == null)
{
if (other.type != null)
return false;
} else if (!type.equals(other.type))
return false;
return true;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -