|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
public interface BundleTemplateMessage
This MessageBuilder implementation creates Message objects by
loading resource bundle keys as templates with values supplied as parameters.
For example:
Given the following Message m
Message m =And the corresponding messageBundle.properties file:MessageFactory.info(newBundleKey("messageBundle", "keyName"), 5, "green") .defaultText("This is default text.").build();
keyName=There are {0} cars, and they are all {1}.
A subsequent call to m.getText() will return:"There are 5 cars, and they are all green."Note: If a bundle/key pair cannot be resolved, the default template will be used instead. If there is no default template, a String representation of the
BundleKey will be displayed instead.
| Method Summary | |
|---|---|
BundleTemplateMessage |
defaults(String text)
Set the default template text. |
BundleTemplateMessage |
key(BundleKey text)
Use the given BundleKey to perform a resource lookup, resolving
the template to render for this message. |
BundleTemplateMessage |
level(Level level)
Set the severity, level of importance of this message. |
BundleTemplateMessage |
params(Object... textParams)
Set the parameters for this builder's template. |
BundleTemplateMessage |
targets(String targets)
Set the targets for this message. |
| Methods inherited from interface org.jboss.seam.international.status.MessageBuilder |
|---|
build |
| Method Detail |
|---|
BundleTemplateMessage key(BundleKey text)
BundleKey to perform a resource lookup, resolving
the template to render for this message.
Any expressions of the form "{0}, {1} ... {N}" found in the template will be interpolated; numbers reference the index of any given parameters, and can be used more than once per template.
BundleTemplateMessage defaults(String text)
If the bundle cannot be loaded for any reason, the builder will fall back
to using provided default template text; if there is no default template,
a string representation of the BundleKey will be used instead.
Any expressions of the form "{0}, {1} ... {N}" found in the template will be interpolated; numbers reference the index of any given parameters, and can be used more than once per template.
BundleTemplateMessage params(Object... textParams)
Parameters may be referenced by index in the template or
#textDefault(String), using expressions of the form " {0}, {1} ...
{N}". The same parameters will be used when interpolating default text, in
the case when a BundleKey cannot be resolved.
BundleTemplateMessage targets(String targets)
BundleTemplateMessage level(Level level)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||