org.jboss.seam.international.status.builder
Interface BundleTemplateMessage

All Superinterfaces:
MessageBuilder

public interface BundleTemplateMessage
extends MessageBuilder

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 = MessageFactory.info(new BundleKey("messageBundle", "keyName"), 5, "green")
    .defaultText("This is default text.").build();
 

And the corresponding messageBundle.properties file:

 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.

Author:
Lincoln Baxter, III, Sebastian Sachtleben

Method Summary
 BundleTemplateMessage defaults(String text)
          Set the default template text.
 BundleTemplateMessage detail(BundleKey detail)
          Use the given BundleKey to perform a resource lookup, resolving the template to render detail text for this message.
 BundleTemplateMessage detailParams(Object... detailParams)
          Set the parameters for detail text of this builder's template.
 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

key

BundleTemplateMessage key(BundleKey text)
Use the given 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.


detail

BundleTemplateMessage detail(BundleKey detail)
Use the given BundleKey to perform a resource lookup, resolving the template to render detail text 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.


defaults

BundleTemplateMessage defaults(String text)
Set the default template 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.


params

BundleTemplateMessage params(Object... textParams)
Set the parameters for this builder's template.

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.


detailParams

BundleTemplateMessage detailParams(Object... detailParams)
Set the parameters for detail text of this builder's template.

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.


targets

BundleTemplateMessage targets(String targets)
Set the targets for this message. If supported by the consuming view-layer, these targets may control where/how the message is displayed to the user.


level

BundleTemplateMessage level(Level level)
Set the severity, level of importance of this message.



Copyright © 2011 Seam Framework. All Rights Reserved.