public class blah
{
private static int ERROR_CREATING_CLIENT = 1234; public void doThis()
{
raiseError(ERROR_CREATING_CLIENT)
}
}As Struts has an application resources file with all the error messages as properties it would be nice if I could derive a bunch of constants from the properties file so that I have one definition of the errors.
my idea is to write some code that will create a class that contains constants based on the application resource file. This will allow compile time checking of the error messages used in code.
So if the message resources file has
exception.clientexists="this client already exists"
A class would be generated that has
public class messages
{
public static string CLIENTEXISTS = "exception.clientexists";
}And the code would
public void doThis()
{
raiseError(messages.CLIENTEXISTS);
}Does anyone know of a better way of doing this? Has something like this already been done?
_________________________________________________________________ Hotmail messages direct to your mobile phone http://www.msn.co.uk/msnmobile
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

