DefaultMessageSourceResolvable (Spring Framework 3.2.1.RELEASE API)
Date: 2013-01-24

org.springframework.context.support

## Class DefaultMessageSourceResolvable

- java.lang.Object
- - org.springframework.context.support.DefaultMessageSourceResolvable

- All Implemented Interfaces:
    Serializable, MessageSourceResolvable
  Direct Known Subclasses:
    ObjectError

      public class DefaultMessageSourceResolvable
      extends Object
      implements MessageSourceResolvable, Serializable

  Default implementation of the `MessageSourceResolvable` interface. Offers an easy way to store all the necessary values needed to resolve a message via a `MessageSource`.
  Since:
    13.02.2004
  Author:
    Juergen Hoeller
  See Also:
    `MessageSource.getMessage(MessageSourceResolvable, java.util.Locale)`, Serialized Form

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `DefaultMessageSourceResolvable(MessageSourceResolvable resolvable)` Copy constructor: Create a new instance from another resolvable.
    `DefaultMessageSourceResolvable(String code)` Create a new DefaultMessageSourceResolvable.
    `DefaultMessageSourceResolvable(String[] codes)` Create a new DefaultMessageSourceResolvable.
    `DefaultMessageSourceResolvable(String[] codes, Object[] arguments)` Create a new DefaultMessageSourceResolvable.
    `DefaultMessageSourceResolvable(String[] codes, Object[] arguments, String defaultMessage)` Create a new DefaultMessageSourceResolvable.
    `DefaultMessageSourceResolvable(String[] codes, String defaultMessage)` Create a new DefaultMessageSourceResolvable.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `equals(Object other)`
    `Object[]` | `getArguments()` Return the array of arguments to be used to resolve this message.
    `String` | `getCode()` Return the default code of this resolvable, that is, the last one in the codes array.
    `String[]` | `getCodes()` Return the codes to be used to resolve this message, in the order that they should get tried.
    `String` | `getDefaultMessage()` Return the default message to be used to resolve this message.
    `int` | `hashCode()`
    `protected String` | `resolvableToString()` Build a default String representation for this MessageSourceResolvable: including codes, arguments, and default message.
    `String` | `toString()` Default implementation exposes the attributes of this MessageSourceResolvable.

    - ### Methods inherited from class java.lang.Object

      `clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

- - ### Constructor Detail

    - #### DefaultMessageSourceResolvable

          public DefaultMessageSourceResolvable(String code)

      Create a new DefaultMessageSourceResolvable.
      Parameters:
        `code` - the code to be used to resolve this message

    - #### DefaultMessageSourceResolvable

          public DefaultMessageSourceResolvable(String[] codes)

      Create a new DefaultMessageSourceResolvable.
      Parameters:
        `codes` - the codes to be used to resolve this message

    - #### DefaultMessageSourceResolvable

          public DefaultMessageSourceResolvable(String[] codes,
                                        String defaultMessage)

      Create a new DefaultMessageSourceResolvable.
      Parameters:
        `codes` - the codes to be used to resolve this message
        `defaultMessage` - the default message to be used to resolve this message

    - #### DefaultMessageSourceResolvable

          public DefaultMessageSourceResolvable(String[] codes,
                                        Object[] arguments)

      Create a new DefaultMessageSourceResolvable.
      Parameters:
        `codes` - the codes to be used to resolve this message
        `arguments` - the array of arguments to be used to resolve this message

    - #### DefaultMessageSourceResolvable

          public DefaultMessageSourceResolvable(String[] codes,
                                        Object[] arguments,
                                        String defaultMessage)

      Create a new DefaultMessageSourceResolvable.
      Parameters:
        `codes` - the codes to be used to resolve this message
        `arguments` - the array of arguments to be used to resolve this message
        `defaultMessage` - the default message to be used to resolve this message

    - #### DefaultMessageSourceResolvable

          public DefaultMessageSourceResolvable(MessageSourceResolvable resolvable)

      Copy constructor: Create a new instance from another resolvable.
      Parameters:
        `resolvable` - the resolvable to copy from

  - ### Method Detail

    - #### getCodes

          public String[] getCodes()

      Description copied from interface: `MessageSourceResolvable`
      Return the codes to be used to resolve this message, in the order that they should get tried. The last code will therefore be the default one.
      Specified by:
        `getCodes` in interface `MessageSourceResolvable`
      Returns:
        a String array of codes which are associated with this message

    - #### getCode

          public String getCode()

      Return the default code of this resolvable, that is, the last one in the codes array.

    - #### getArguments

          public Object[] getArguments()

      Description copied from interface: `MessageSourceResolvable`
      Return the array of arguments to be used to resolve this message.
      Specified by:
        `getArguments` in interface `MessageSourceResolvable`
      Returns:
        an array of objects to be used as parameters to replace placeholders within the message text
      See Also:
        `MessageFormat`

    - #### getDefaultMessage

          public String getDefaultMessage()

      Description copied from interface: `MessageSourceResolvable`
      Return the default message to be used to resolve this message.
      Specified by:
        `getDefaultMessage` in interface `MessageSourceResolvable`
      Returns:
        the default message, or `null` if no default

    - #### resolvableToString

          protected final String resolvableToString()

      Build a default String representation for this MessageSourceResolvable: including codes, arguments, and default message.

    - #### toString

          public String toString()

      Default implementation exposes the attributes of this MessageSourceResolvable. To be overridden in more specific subclasses, potentially including the resolvable content through `resolvableToString()`.
      Overrides:
        `toString` in class `Object`
      See Also:
        `resolvableToString()`

    - #### equals

          public boolean equals(Object other)

      Overrides:
        `equals` in class `Object`

    - #### hashCode

          public int hashCode()

      Overrides:
        `hashCode` in class `Object`