Package org.passay.resolver
Class SpringMessageResolver
java.lang.Object
org.passay.resolver.SpringMessageResolver
- All Implemented Interfaces:
MessageResolver
Provides implementation for resolving validation message using Spring's
MessageSource.- Version:
- 1.3.1
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final MessageResolverTheMessageResolverfor fallbackprivate final org.springframework.context.support.MessageSourceAccessorAn accessor for Spring'sMessageSource -
Constructor Summary
ConstructorsConstructorDescriptionSpringMessageResolver(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
Modifier and TypeMethodDescriptionresolve(RuleResultDetail detail) Resolves the message for the supplied rule result detail using Spring'sMessageSource.
-
Field Details
-
messageSourceAccessor
private final org.springframework.context.support.MessageSourceAccessor messageSourceAccessorAn accessor for Spring'sMessageSource -
fallbackMessageResolver
TheMessageResolverfor fallback
-
-
Constructor Details
-
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 Details
-
resolve
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:
resolvein interfaceMessageResolver- Parameters:
detail- rule result detail- Returns:
- message for the detail error code
-