com.tzavellas.validation.spring
Class MessageSourceResolver

java.lang.Object
  extended by com.tzavellas.validation.spring.MessageSourceResolver
All Implemented Interfaces:
MessageResolver

public class MessageSourceResolver
extends Object
implements MessageResolver

An adapter class from Spring's MessageSource to MessageResolver.

Author:
Spiros Tzavellas

Constructor Summary
MessageSourceResolver(MessageSource source)
          Construct a MessageSourceResolver.
 
Method Summary
 String getMessage(ValidationError error, Locale locale)
          Resolve the error message for the specified ValidationError.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MessageSourceResolver

public MessageSourceResolver(MessageSource source)
Construct a MessageSourceResolver.

Parameters:
source - the MessageSource to delegate for resolving the messages.
Method Detail

getMessage

public String getMessage(ValidationError error,
                         Locale locale)
Description copied from interface: MessageResolver
Resolve the error message for the specified ValidationError.

Specified by:
getMessage in interface MessageResolver
Parameters:
error - the ValidationError
locale - the locale to use. If null then the implementation is responsible to determine which locale to use
Returns:
an appropriate message for the specified Locale, else the default message.


Copyright © 2007-2009 spiros.blog(). All Rights Reserved.