Package org.jboss.solder.messages

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

See:
          Description

Interface Summary
ParameterConverter<I> A converter for a specific parameter type.
 

Class Summary
MessageBundleInvocationHandler  
Messages A factory class to produce message bundle implementations.
 

Enum Summary
Message.Format The possible format types.
 

Annotation Types Summary
Cause Mark a parameter as being the "exception cause" parameter rather than a positional format parameter.
Formatter Indicate that the given parameter should be wrapped with a formatting object of the given class.
Locale Specifies a Locale for a typed logger.
Message Assigns a message string to a resource method.
MessageBundle Signify that an interface is a message bundle interface.
 

Package org.jboss.solder.messages Description

Seam 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. Seam 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 © 2008-2011 Seam Framework. All Rights Reserved.