如果我有以下
public enum MY_ENUM_THING
{
NAME("JOE"),
SOMETHING,
ISWORKING(true);
private String parameter;
private boolean truth;
MY_ENUM_THING()
{
}
MY_ENUM_THING(String parameter)
{
this.parameter = parameter;
}
MY_ENUM_THING(boolean truth)
{
this.truth = truth
}
public ?? getEnumValue()
{
// this method (return) is what would be jamming me up
}
}
无论枚举的类型是什么,我如何让我的回报返回?
示例和期望的结果
System.out.print(MY_ENUM_THING.NAME.getEnumValue());
//JOE
System.out.print(MY_ENUM_THING.SOMETHING.getEnumValue());
//SOMETHING <-- just return SOMETHING.name()
System.out.print(MY_ENUM_THING.ISWORKING.getEnumValue());
//true