Class SpringMessageResolver

  • All Implemented Interfaces:
    MessageResolver

    public class SpringMessageResolver
    extends Object
    implements MessageResolver
    Provides implementation for resolving validation message using using Spring's MessageSource.
    Version:
    1.3.1
    Author:
    Kazuki Shimizu
    • 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 spring
        locale - 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's MessageSource. (If the message can't retrieve from a MessageSource, return default message provided by passay)
        Specified by:
        resolve in interface MessageResolver
        Parameters:
        detail - rule result detail
        Returns:
        message for the detail error code