Class MessageSourceChain

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

    public class MessageSourceChain
    extends Object
    implements org.springframework.context.MessageSource
    A MessageSource that wraps multiple MessageSource and processes them in sequence. The message is always taken from the first MessageSource that returns a non-null value (if any).
    Author:
    Matthias Müller
    • Constructor Detail

      • MessageSourceChain

        public MessageSourceChain()
      • MessageSourceChain

        public MessageSourceChain​(org.springframework.context.MessageSource... messageSources)
    • Method Detail

      • getMessage

        public String getMessage​(String code,
                                 Object[] args,
                                 String defaultMessage,
                                 Locale locale)
        Specified by:
        getMessage in interface org.springframework.context.MessageSource
      • getMessage

        public String getMessage​(String code,
                                 Object[] args,
                                 Locale locale)
                          throws org.springframework.context.NoSuchMessageException
        Specified by:
        getMessage in interface org.springframework.context.MessageSource
        Throws:
        org.springframework.context.NoSuchMessageException
      • getMessage

        public String getMessage​(org.springframework.context.MessageSourceResolvable resolvable,
                                 Locale locale)
                          throws org.springframework.context.NoSuchMessageException
        Specified by:
        getMessage in interface org.springframework.context.MessageSource
        Throws:
        org.springframework.context.NoSuchMessageException
      • getMessageSources

        public org.springframework.context.MessageSource[] getMessageSources()
      • setMessageSources

        public void setMessageSources​(org.springframework.context.MessageSource[] messageSources)