I have a project which uses an enum to be used as a parameter for a class which signature is like this:
public class MyClass<E extends Enum<E>> extends ExtendedClass
The thing is, I don't want to define an enum and do the same programming again for each new enum.
I was thinking of ByteBuddy to generate enums at runtime. but I'm not finding a neat way to do this and the resources are not so much .
edit:
To be more specific, what I have in my code:
private enum MyEnum{
FOO, BAR;
}
MyClass<MyEnum> obs = new MyClass<MyEnum>()
It does not work when I use the Enum generated by ByteBuddy; It's not considered as a type in this case (compilation error).
Is there some trick to use or that's it what can be done in run-time?