org.sonatype.sisu.goodies.i18n
Class ResourceBundleMessageSource
java.lang.Object
org.sonatype.sisu.goodies.common.ComponentSupport
org.sonatype.sisu.goodies.i18n.ResourceBundleMessageSource
- All Implemented Interfaces:
- MessageSource
public class ResourceBundleMessageSource
- extends ComponentSupport
- implements MessageSource
Message source backed up by ResourceBundle
instances.
- Since:
- 1.0
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
ResourceBundleMessageSource
public ResourceBundleMessageSource(Locale locale)
ResourceBundleMessageSource
public ResourceBundleMessageSource(Class... types)
getLocale
public Locale getLocale()
add
public ResourceBundleMessageSource add(boolean required,
Class... types)
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
getMessage
public String getMessage(String code,
String defaultValue)
- Specified by:
getMessage
in interface MessageSource
format
public String format(String code,
@Nullable
Object... args)
- Format a message (based on
String.format(java.lang.String, java.lang.Object...)
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-2012 Sonatype, Inc.. All Rights Reserved.