org.springframework.binding.form.support
Class DefaultMessageCodeStrategy

java.lang.Object
  extended by org.springframework.binding.form.support.DefaultMessageCodeStrategy
All Implemented Interfaces:
MessageCodeStrategy

public class DefaultMessageCodeStrategy
extends Object
implements MessageCodeStrategy

Default implementation for MessageCodeStrategy. It creates message codes as follows:

{contextId}.{field}.{suffix}
{field}.{suffix} - without a contextId
{field} - without a contextId and no suffix

If field contains a name which is separated by '.' like 'fieldcontext.field':

{contextId}.fieldcontext.field.{suffix}
{contextId}.field.{suffix}
fieldcontext.field.{suffix} - without a contextId
field.{suffix} - without a contextId
fieldcontext.field - without a contextId and no suffix
field - without a contextId and no suffix

Author:
Mathias Broekelmann

Constructor Summary
DefaultMessageCodeStrategy()
           
 
Method Summary
 String[] getMessageCodes(String contextId, String field, String[] suffixes)
          Creates message codes.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultMessageCodeStrategy

public DefaultMessageCodeStrategy()
Method Detail

getMessageCodes

public String[] getMessageCodes(String contextId,
                                String field,
                                String[] suffixes)
Description copied from interface: MessageCodeStrategy
Creates message codes.

Specified by:
getMessageCodes in interface MessageCodeStrategy
Parameters:
contextId - optional contextId of the field.
field - the field. The field name
suffixes - optional array of suffixes.
Returns:
an array of message codes


Copyright © 2004-2008 The Spring Framework. All Rights Reserved.