Package org.jboss.solder.messages

Solder provides injectable typed message bundles (suitable for internationalization and localization)

See: Description

Package org.jboss.solder.messages Description

Solder provides injectable typed message bundles (suitable for internationalization and localization)

Often times you need to access a localized message. For example, you need to localize an exception message. Solder let's you retrieve this message from a typed message logger to avoid having to use hard-coded string messages.

First, declare the message bundle as an annotated interface with methods configured as message accessors. You can configured the messages to use printf-style interpolations of parameters (%s).

 @MessageBundle
 public interface TrainMessages {

    @Message("No trains spotted due to %s")
    String noTrainsSpotted(String cause);

 }
 

Now inject the interface:

    @Inject @MessageBundle TrainMessages messages;
 

And use it:

   throw new BadDayException(messages.noTrainsSpotted("leaves on the line"));
 
See Also:
Message, MessageBundle, Locale

Copyright © 2012 Seam Framework. All Rights Reserved.