Overview | Package | Class | Tree | Deprecated | Index | Help
| Spring Web Flow
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.springframework.binding.message
Class DefaultMessageContext

    java.lang.Object
      org.springframework.binding.message.DefaultMessageContext

All Implemented Interfaces:
  MessageContext, StateManageableMessageContext

    public class DefaultMessageContext

extends java.lang.Object
implements StateManageableMessageContext

The default message context implementation. Uses a `MessageSource` to resolve messages that are added by callers.

Author:
  Keith Donald

Constructor Summary
`DefaultMessageContext()` Creates a new default message context.
`DefaultMessageContext(org.springframework.context.MessageSource messageSource)` Creates a new default message context.

Method Summary
`void` | `addMessage(MessageResolver messageResolver)` Add a new message to this context.
`void` | `clearMessages()` Clear all messages added to this context.
`java.io.Serializable` | `createMessagesMemento()` Create a serializable memento, or token representing a snapshot of the internal state of this message context.
`Message[]` | `getAllMessages()` Get all messages in this context.
`Message[]` | `getMessagesByCriteria(MessageCriteria criteria)` Get all messages that meet the given result criteria.
`Message[]` | `getMessagesBySource(java.lang.Object source)` Get all messages in this context for the source provided.
`org.springframework.context.MessageSource` | `getMessageSource()`
`boolean` | `hasErrorMessages()` Returns true if there are error messages in this context.
`void` | `restoreMessages(java.io.Serializable messagesMemento)` Set the state of this context from the memento provided.
`void` | `setMessageSource(org.springframework.context.MessageSource messageSource)` Configure the message source used to resolve messages added to this context.
`java.lang.String` | `toString()`

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

Constructor Detail

### DefaultMessageContext

    public DefaultMessageContext()

  Creates a new default message context. Defaults to a message source that simply resolves default text and cannot resolve localized message codes.

### DefaultMessageContext

    public DefaultMessageContext(org.springframework.context.MessageSource messageSource)

  Creates a new default message context.

  Parameters:
    `messageSource` - the message source to resolve messages added to this context

Method Detail

### getMessageSource

    public org.springframework.context.MessageSource getMessageSource()

### getAllMessages

    public Message[] getAllMessages()

  Description copied from interface: `MessageContext`
  Get all messages in this context. The messages returned should be suitable for display as-is.

  Specified by:
    `getAllMessages` in interface `MessageContext`
  Returns:
    the messages

### getMessagesBySource

    public Message[] getMessagesBySource(java.lang.Object source)

  Description copied from interface: `MessageContext`
  Get all messages in this context for the source provided.

  Specified by:
    `getMessagesBySource` in interface `MessageContext`
  Parameters:
    `source` - the source associated with messages, or null for global messages
  Returns:
    the source's messages

### getMessagesByCriteria

    public Message[] getMessagesByCriteria(MessageCriteria criteria)

  Description copied from interface: `MessageContext`
  Get all messages that meet the given result criteria.

  Specified by:
    `getMessagesByCriteria` in interface `MessageContext`
  Parameters:
    `criteria` - the message criteria

### hasErrorMessages

    public boolean hasErrorMessages()

  Description copied from interface: `MessageContext`
  Returns true if there are error messages in this context.

  Specified by:
    `hasErrorMessages` in interface `MessageContext`
  Returns:
    error messages

### addMessage

    public void addMessage(MessageResolver messageResolver)

  Description copied from interface: `MessageContext`
  Add a new message to this context.

  Specified by:
    `addMessage` in interface `MessageContext`
  Parameters:
    `messageResolver` - the resolver that will resolve the message to be added

### clearMessages

    public void clearMessages()

  Description copied from interface: `MessageContext`
  Clear all messages added to this context.

  Specified by:
    `clearMessages` in interface `MessageContext`

### createMessagesMemento

    public java.io.Serializable createMessagesMemento()

  Description copied from interface: `StateManageableMessageContext`
  Create a serializable memento, or token representing a snapshot of the internal state of this message context.

  Specified by:
    `createMessagesMemento` in interface `StateManageableMessageContext`
  Returns:
    the messages memento

### restoreMessages

    public void restoreMessages(java.io.Serializable messagesMemento)

  Description copied from interface: `StateManageableMessageContext`
  Set the state of this context from the memento provided. After this call, the messages in this context will match what is encapsulated inside the memento. Any previous state will be overridden.

  Specified by:
    `restoreMessages` in interface `StateManageableMessageContext`
  Parameters:
    `messagesMemento` - the messages memento

### setMessageSource

    public void setMessageSource(org.springframework.context.MessageSource messageSource)

  Description copied from interface: `StateManageableMessageContext`
  Configure the message source used to resolve messages added to this context. May be set at any time to change how coded messages are resolved.

  Specified by:
    `setMessageSource` in interface `StateManageableMessageContext`
  Parameters:
    `messageSource` - the message source
  See Also:
    `MessageContext.addMessage(MessageResolver)`

### toString

    public java.lang.String toString()

  Overrides:
    `toString` in class `java.lang.Object`

Overview | Package | Class | Tree | Deprecated | Index | Help
| Spring Web Flow
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD