If I have the following
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
}
}
How do I get my return to return whatever the type of the enum is?
Example and desired results
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
Find a better design. Java does not work well like this. The only common class to all return types is Object (boolean -> Boolean). Do you want to check the class of the return type every time you call this method before you cast it to the appropriate type.
Your design is also bad as enums are meant to represent a finite set of values each with the same type and properties. You are creating three totally different objects that represent three different things.
You need to look at your use case and come up with a better design. You could even post a separate question asking for advice.