Details
-
New Feature
-
Status: Closed
-
Major
-
Resolution: Fixed
-
0.2-incubating
-
None
Description
Add the possibility to use convention for @MessageResource annotated types.
If there is no @MessageTemplate given for a defined method then the method itself shall provide the information for the property key.
Example:
@MessageResource
class MyMessages() {
String getErrorMessage();
String getGetError();
@MessageTemplate("MESSGAE_WARN")
String getWarnMessage();
}
The convention would be:
1. If method name starts with 'get' remove it.
2. Split the method name at the upper case characters and seperate the parts with underscore.
getErrorMessage() ->
{Error, Message} -> ERROR_MESSAGE.
getGetError() ->
-> GET_ERROR. (not pretty i know, just an example)
getWarnMessage() is already defined
Maybe the missing annotation could be added at the method of the type at deployment time.
So there would be no need to provide property key name for every method, because if someone like me has a lot of messages and kept to the convention i described, it would be easier to switch to delta-spike i18n and also less work to do.
So the existing implementation could be used as it is now. And during runtime, the interface would be as i18n needs it.