org.sonatype.gshell.util.i18n
Class ResourceBundleMessageSource

java.lang.Object
  extended by org.sonatype.gshell.util.i18n.ResourceBundleMessageSource
All Implemented Interfaces:
MessageSource

public class ResourceBundleMessageSource
extends Object
implements MessageSource

Message source backed up by ResourceBundle instances.

Since:
2.0
Author:
Jason Dillon

Constructor Summary
ResourceBundleMessageSource(Class... types)
           
ResourceBundleMessageSource(Locale locale)
           
 
Method Summary
 ResourceBundleMessageSource add(boolean required, Class... types)
           
 ResourceBundleMessageSource add(Class... types)
           
 String format(String code, Object... args)
          Format a message (based on MessageFormat using the message from the resource bundles using the given code as a pattern and the given objects as arguments.
 Locale getLocale()
           
 String getMessage(String code)
          Get a raw message from the resource bundles using the given code.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ResourceBundleMessageSource

public ResourceBundleMessageSource(Locale locale)

ResourceBundleMessageSource

public ResourceBundleMessageSource(Class... types)
Method Detail

add

public ResourceBundleMessageSource add(boolean required,
                                       Class... types)

getLocale

public Locale getLocale()

add

public ResourceBundleMessageSource add(Class... types)

getMessage

public String getMessage(String code)
Get a raw message from the resource bundles using the given code.

Specified by:
getMessage in interface MessageSource

format

public String format(String code,
                     Object... args)
Format a message (based on MessageFormat using the message from the resource bundles using the given code as a pattern and the given objects as arguments.

Specified by:
format in interface MessageSource


Copyright © 2008-2011 Sonatype. All Rights Reserved.