Package org.passay.spring
Class SpringMessageResolver
- java.lang.Object
-
- org.passay.spring.SpringMessageResolver
-
- All Implemented Interfaces:
MessageResolver
public class SpringMessageResolver extends Object implements MessageResolver
Provides implementation for resolving validation message using using Spring'sMessageSource
.- Version:
- 1.3.1
- Author:
- Kazuki Shimizu
-
-
Constructor Summary
Constructors Constructor Description SpringMessageResolver(org.springframework.context.MessageSource messageSource)
Create a new instance with the locale associated with the current thread.SpringMessageResolver(org.springframework.context.MessageSource messageSource, Locale locale)
Create a new instance with the specified locale.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description String
resolve(RuleResultDetail detail)
Resolves the message for the supplied rule result detail using Spring'sMessageSource
.
-
-
-
Constructor Detail
-
SpringMessageResolver
public SpringMessageResolver(org.springframework.context.MessageSource messageSource)
Create a new instance with the locale associated with the current thread.- Parameters:
messageSource
- a message source managed by spring
-
SpringMessageResolver
public SpringMessageResolver(org.springframework.context.MessageSource messageSource, Locale locale)
Create a new instance with the specified locale.- Parameters:
messageSource
- a message source managed by springlocale
- the locale to use for message access
-
-
Method Detail
-
resolve
public String resolve(RuleResultDetail detail)
Resolves the message for the supplied rule result detail using Spring'sMessageSource
. (If the message can't retrieve from aMessageSource
, return default message provided by passay)- Specified by:
resolve
in interfaceMessageResolver
- Parameters:
detail
- rule result detail- Returns:
- message for the detail error code
-
-