Class CombinableMessageSource

  • All Implemented Interfaces:
    org.springframework.context.HierarchicalMessageSource , org.springframework.context.MessageSource

    
    public class CombinableMessageSource
    extends AbstractMessageSource
                        

    Handles itself first, then handles [brother] it, then the parent

    Since:

    2019-09-15

    Author:

    trydofor

    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
    • Method Summary

      Modifier and Type Method Description
      void removeMessage(String code)
      void removeMessage(String code, Locale locale)
      void addMessage(String code, Locale locale, String msg)
      void addMessage(Map<out Object, out Object> messages, Locale locale)
      void setParentMessageSource(@Nullable() MessageSource parent)
      void addMessage(HierarchicalMessageSource messageSource, int order) Combine other messageSource in order, and the one with the smaller order number will be resolved first.
      void removeMessage(HierarchicalMessageSource messageSource) remove messageSource
      • Methods inherited from class org.springframework.context.support.AbstractMessageSource

        getMessage, getParentMessageSource, setCommonMessages, setParentMessageSource, setUseCodeAsDefaultMessage
      • Methods inherited from class org.springframework.context.support.MessageSourceSupport

        setAlwaysUseMessageFormat
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • CombinableMessageSource

        CombinableMessageSource()
    • Method Detail

      • addMessage

         void addMessage(HierarchicalMessageSource messageSource, int order)

        Combine other messageSource in order, and the one with the smaller order number will be resolved first. If order equals Integer.MIN_VALUE, it means that the message will be removed.

        Parameters:
        messageSource - other messageSource
        order - order Integer#MIN_VALUE means remove
      • removeMessage

         void removeMessage(HierarchicalMessageSource messageSource)

        remove messageSource

        Parameters:
        messageSource - to be removed