## org.codehaus.groovy.tools.shell.util
Class MessageSource

    java.lang.Object
      groovy.lang.GroovyObjectSupport
          org.codehaus.groovy.tools.shell.util.MessageSource

All Implemented Interfaces:
  GroovyObject

Direct Known Subclasses:
  ANSI.RenderMessageSource

    public class MessageSource

extends GroovyObjectSupport

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

Version:
  $Id: MessageSource.java 7767 2007-08-27 19:47:34Z user57 $
Author:
  Jason Dillon

Constructor Summary
`MessageSource(Class type)`
`MessageSource(Class[] types)`
`MessageSource(String name)`
`MessageSource(String[] names)`

Method Summary
`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.
`String` `getMessage(String code)` Get a raw message from the resource bundles using the given code.
`Object` `getProperty(String name)` Retrieves a property value.

Methods inherited from class groovy.lang.GroovyObjectSupport
`getMetaClass, invokeMethod, setMetaClass, setProperty`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### MessageSource

    public MessageSource(String[] names)

### MessageSource

    public MessageSource(String name)

### MessageSource

    public MessageSource(Class[] types)

### MessageSource

    public MessageSource(Class type)

Method Detail

### getMessage

    public String getMessage(String code)

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

### 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.

### getProperty

    public Object getProperty(String name)

  Description copied from interface: `GroovyObject`
  Retrieves a property value.

  Specified by:
    `getProperty` in interface `GroovyObject`
  Overrides:
    `getProperty` in class `GroovyObjectSupport`
  Parameters:
    `name` - the name of the property of interest
  Returns:
    the given property
  See Also:
    `getMessage(String)`

Copyright © 2003-2009 The Codehaus. All rights reserved.