I have many classes with static final fields which are used as default values or config. What is best approach to create global config file? Should I move these fields to single static class, use properties file or what?
Edit: I need to use this values both in java classes and xhtml pages. Values dosen't depend on envirnoment. I could compile project to set new values - no problem.
The answer depends...
enum
to static final
constants where possible (avoid "stringly typed" code)TimeUnit
to convert hours to seconds, rather than having static final int SECONDS_IN_HOUR = 3600;
)public static final
in the class that has "most ownership" over themIf you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With