I have a method on which I need to pass an enum as a parameter.
public <T> T doSomething(SomeEnum operation, Class<T> something);
I have several enums and the method is a common one which should work with any enums. What is the correct way to write this method signature to accept any generic enum types? I know that I can use a marker interface to this purpose, but I would like to write it with generic enum signatures. Please advise me on this.
Whats the bad idea with the below one: (It works but I get warnings from IDE saying it is a raw type. I’m not clear about the reason).
public void doSomething(Enum operation);
EDIT: An example according to your modifications:
EDIT2:
if you need T and the Enum as separate types, then you’ll need: