java property file as enum

前端 未结 8 1082
梦如初夏
梦如初夏 2020-12-24 09:47

Is it possible to convert a property file into an enum.

I have a propoerty file with lot of settings. for example

equipment.height
equipment.widht
e         


        
8条回答
  •  南方客
    南方客 (楼主)
    2020-12-24 10:15

    You can turn a properties file into an enum with generated code. You can do this staticly before the program is compiled and optionally at runtime by using the Compiler API. Doing this adds a a lot of complexity and usually its simpler to use a Map as has been suggested.

提交回复
热议问题