java property file as enum

前端 未结 8 1080
梦如初夏
梦如初夏 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:24

    Java has static typing. That means, you can't create types dynamically. So, the answer is no. You can't convert a property file into a enum.

    What you could do is generate an enum from that properties file. Or, use a Dictionary (Map) to access your properties with something like:

    equipment.get("height");
    

提交回复
热议问题