DEV Community

Discussion on: Dynamic Enums

Collapse
mustabelmo profile image
Mustapha Belmokhtar

this is a great workaround, but won't tjis affect the performances? especially when you use reflection to load the data and to 'enumerate' the fields?

Collapse
darshitpp profile image
Darshit Patel Author

Perhaps, there may be a slight performance hit, but the part using Reflections runs only once -- when the class is loaded for the first time. We can, of course, manually use map.put(), but the intent was for us asking the JVM to do it automatically. I do not have benchmarks for this, but would be happy to include it in the post should you do so!