How to deal with system "static" data in java
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 ...
No comments:
Post a Comment