See: Description
Class | Description |
---|---|
AnnotationsMessages |
Internationalized messages specific to the annotations module
|
CoreMessages | |
LocaleMessageHandler |
The
LocaleMessageHandler is essentially a merging of the Message
and Messages classes, since there is no good reason to have them separate. |
Message | |
MessageFactory | |
ReloadControl |
Message
class is a wrapper for an error message,
its error code and other information. The messages are read from ResourceBundle
s
usually from classpath.
The class MessageFactory
encapsulates the lookup of
ResourceBundle
s and creation of messages. Since each mule
module should provide its own messages, subclasses of MessageFactory
should be created. It is convention to put the module specific class in
a subpackage called i18n
.
org.mule.module.foo
a MessageFactory subclass would typcially look like this:
package org.mule.module.foo.i18n; public class FooMessages extends MessageFactory { private static final String BUNDLE_PATH = getBundlePath("foo"); public static final Message foo() { return createMessage(BUNDLE_PATH, 1); } public static final Message bar(String arg) { return createMessage(BUNDLE_PATH, 2, arg); } . . . }Note that the only publicly available methods are those from
FooMessages
. This approach has various advantages:
Message
instances are created using meaningful
java methods, i.e. client code is less cluttered with message
cration details.MessageFactory
subclass it
is ensured that the correct ResourceBundle
will be
chosen for lookup.
Copyright © 2003–2016 MuleSoft, Inc.. All rights reserved.