Simply put I'd like to centralize any message with a code and a custom message that, in the future, could support translating.
So, my idea would be to list all couples:
MSG1= new Message("M1", "Howdy");
MSG2 = new Message( "M2", "ehy");
and, in my application, I just do:
throw new MyException(MSG1);
or
myResponse.addMessage(MSG2);
Now the main question, how do I store messages?
- Static class/enumeration
- External property file
- Database
All 3 are feasible but is there any "standard" approach? Moreover I'm assuming to create a custom library for this, but isn't there any premade one that I can include?
Aucun commentaire:
Enregistrer un commentaire