Top Description Fields Constructors Methods
org.codehaus.groovy.tools.shell.util

public Class MessageSource

extends GroovyObjectSupport
Class Inheritance
Imports
groovy.lang.GroovyObjectSupport, java.text.MessageFormat, java.util.MissingResourceException, .ResourceBundle

Message source backed up by one or more java.util.ResourceBundle instances for simple i18n support.

Field Summary

Modifier and TypeField and Description
private final String[]
private ResourceBundle[]

Constructor Summary

AccessConstructor and Description
public
MessageSource(final String[] names)

public
MessageSource(final String name)

public
MessageSource(final Class<T>[] types)

public
MessageSource(final Class<T> type)

Method Summary

Modifier and TypeMethod and Description
private static String[]
classNames(final Class<T>[] types)

private ResourceBundle[]
public String
format(final String code, final 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.

private ResourceBundle[]
public String
getMessage(final String code)

Get a raw message from the resource bundles using the given code.

public Object
getProperty(final String
the name of the property of interest
name
)

Overrides default groovy.lang.GroovyObject.getProperty.

Retrieves a property value.
Inherited from groovy.lang.GroovyObjectSupport:
getMetaClasssetMetaClass

Field Detail

bundleNamesback to summary
private final String[] bundleNames
cachedBundlesback to summary
private ResourceBundle[] cachedBundles

Constructor Detail

MessageSourceback to summary
public MessageSource(final String[] names)
MessageSourceback to summary
public MessageSource(final String name)
MessageSourceback to summary
public MessageSource(final Class<T>[] types)
MessageSourceback to summary
public MessageSource(final Class<T> type)

Method Detail

classNamesback to summary
private static String[] classNames(final Class<T>[] types)
createBundlesback to summary
private ResourceBundle[] createBundles()
formatback to summary
public String format(final String code, final 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.

getBundlesback to summary
private ResourceBundle[] getBundles()
getMessageback to summary
public String getMessage(final String code)

Get a raw message from the resource bundles using the given code.

getPropertyback to summary
public Object getProperty(final String name)

Overrides default groovy.lang.GroovyObject.getProperty.

Doc from groovy.lang.GroovyObject.getProperty.

Retrieves a property value.

Parameters
name:String

the name of the property of interest

Returns:Object

the given property

See Also
getMessage(String)