java property file as enum

前端 未结 8 1092
梦如初夏
梦如初夏 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条回答
  •  Happy的楠姐
    2020-12-24 10:31

    no, I don't think so. Enums are creating in compile time and thus their number of elements cannot vary depending on whatever it is in the property file.

    It's more likely that you would need an structure that is flexible to be constructed in runtime - maybe an associative array.

提交回复
热议问题