javaname-value

Properties or Enums or static final


When it comes to declare predefined constants in a name-value pair, I have been randomly choosing between 'java.util.Properties', 'enums' or a separate class with 'public static final' values.

For future reference, I need some guidelines over which approach to take.

Thanks!


Solution

  • It all depends of your constant lifecycle. Constant are by definition something that do not move. Choosing the right methods will be a question of the likely to change and the repackaging need.