I was just wondering if there is some better way how to handle system "static" configuration data. Let say you have a system which offers several operation which are in code translated to operation code but you need to keep other related information to that operation like description, priority etc. Nasty way I have seen is public static final constants. Better way I was using before was create a class eg:
public abstract Codebook{
private int id;
private String description;
... getters setters
}
Then for given cathegory - in this case OperationalCode:
public class OperationalCode extends Codebook{}
Instance of this class were created with the data from BD. Now I cannot use DB so I thought I will create factories which will populate classes with given set of parameters. BUT all is hardcoded to factory class which I don't like.
Is there a better solution how to tackle this case as I believe I am not the first one solving that. Some handy framework or ...
I wasn't probably clear enough. I am fully aware of Properties capability in java but that doesn't match the criteria. Let me explain more: When I say configuration I mean business configuration. You never know how many possible items you will get. For example in banking system you can cancel contract and you are forced to provide a reason for termination - predefined list which includes text, code in your system and translation to codes of third party systems where your system need to perform cancelation operation as well. Those possibilities need to be externalized of your system as they will probably change offten. Property files doesn't seems as a right choice and the opposite site - using Buisiness Rule Systems (e.g. Drools ) seems to me as overkill. Using enums with specified properties wouldn't fit quit well because time to time you need to be able to recognize that it is configuration and not just normal enum. That the reason for class inheritance - instanceof operator solve this.