Is there any way to add elements to a built in enum class in Java?
My question is similar to Can I add and remove elements of enumeration at runtime in Java, but that question seems to be geared towards constructing your own enum and then modifying it. I'm assuming there's an existing enum somewhere I can't change, something like
enum Days{ MONDAY, TUESDAY, WEDNESDAY }
and I want to add Thursday, Friday, etc. to it. So unfortunately, suggestions of how to use an interface to accomplish my goal, or other methods that would be more effective than enums, don't apply here.
As I understand it, enums are implicitly final, so I can't extend it and add more elements to it. It has private fields, but it appears I can use reflection to access those - could I change one of the private fields, even if I can't add a new one, i.e, change Monday to Thursday?
Edit: Clarification of Circumstances
People have suggested altering the code before it's compiled into the program. My code is part of a larger project that I can't change; the class with the enum in it is loaded by the larger program before my class gets access to it. At that point, I'd like to add the missing elements to the enum. Is bytecode manipulation still the way to go?