Package ch.qos.cal10n
Class MessageConveyor
- java.lang.Object
-
- ch.qos.cal10n.MessageConveyor
-
- All Implemented Interfaces:
IMessageConveyor
public class MessageConveyor extends Object implements IMessageConveyor
The default implementation forIMessageConveyorbased on resource bundles. See alsogetMessage(Enum, Object...)for details.- Author:
- Ceki Gülcü
-
-
Constructor Summary
Constructors Constructor Description MessageConveyor(Locale locale)TheLocaleassociated with this instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description StringgetMessage(MessageParameterObj mpo)Syntactic sugar for the case where the massage is contained in aMessageParameterObj.<E extends Enum<?>>
StringgetMessage(E key, Object... args)Given an enum as key, find the resource bundle corresponding to this locale and return the message corresponding to the key passed as parameter (internationalized per this locale).
-
-
-
Method Detail
-
getMessage
public <E extends Enum<?>> String getMessage(E key, Object... args) throws MessageConveyorException
Given an enum as key, find the resource bundle corresponding to this locale and return the message corresponding to the key passed as parameter (internationalized per this locale). The name of the resource bundle is defined via theBaseNameannotation whereas the locale is specified in this MessageConveyor instance's constructor.- Specified by:
getMessagein interfaceIMessageConveyor- Type Parameters:
E- an enum type- Parameters:
key- an enum instance used as message keyargs- optional arguments- Returns:
- The translated/localized message
- Throws:
MessageConveyorException
-
getMessage
public String getMessage(MessageParameterObj mpo) throws MessageConveyorException
Description copied from interface:IMessageConveyorSyntactic sugar for the case where the massage is contained in aMessageParameterObj.Equivalent to calling
getMessage(mpo.getKey(), mpo.getArgs());
- Specified by:
getMessagein interfaceIMessageConveyor- Parameters:
mpo- The MessageParameterObj to translate- Returns:
- translated message
- Throws:
MessageConveyorException- See Also:
IMessageConveyor.getMessage(Enum, Object...)
-
-