Class StringFormattedMessage

  • All Implemented Interfaces:
    java.io.Serializable, Message

    public class StringFormattedMessage
    extends java.lang.Object
    implements Message
    Handles messages that consist of a format string conforming to Formatter.

    Note to implementors:

    This class implements the unrolled args API even though StringFormattedMessage does not. This leaves the room for StringFormattedMessage to unroll itself later.

    See Also:
    Serialized Form
    • Constructor Summary

      Constructors 
      Constructor Description
      StringFormattedMessage​(java.lang.String messagePattern, java.lang.Object... arguments)
      Constructs a message.
      StringFormattedMessage​(java.util.Locale locale, java.lang.String messagePattern, java.lang.Object... arguments)
      Constructs a message.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean equals​(java.lang.Object o)  
      protected java.lang.String formatMessage​(java.lang.String msgPattern, java.lang.Object... args)  
      java.lang.String getFormat()
      Returns the message pattern.
      java.lang.String getFormattedMessage()
      Returns the formatted message.
      java.lang.Object[] getParameters()
      Returns the message parameters.
      java.lang.Throwable getThrowable()
      Return the throwable passed to the Message.
      int hashCode()  
      private void readObject​(java.io.ObjectInputStream in)  
      java.lang.String toString()  
      private void writeObject​(java.io.ObjectOutputStream out)  
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, wait, wait, wait
    • Field Detail

      • LOGGER

        private static final Logger LOGGER
      • messagePattern

        private java.lang.String messagePattern
      • argArray

        private transient java.lang.Object[] argArray
      • stringArgs

        private java.lang.String[] stringArgs
      • formattedMessage

        private transient java.lang.String formattedMessage
      • throwable

        private transient java.lang.Throwable throwable
      • locale

        private final java.util.Locale locale
    • Constructor Detail

      • StringFormattedMessage

        public StringFormattedMessage​(java.util.Locale locale,
                                      java.lang.String messagePattern,
                                      java.lang.Object... arguments)
        Constructs a message.
        Parameters:
        locale - the locale for this message format
        messagePattern - the pattern for this message format
        arguments - The objects to format
        Since:
        2.6
      • StringFormattedMessage

        public StringFormattedMessage​(java.lang.String messagePattern,
                                      java.lang.Object... arguments)
        Constructs a message.
        Parameters:
        messagePattern - the pattern for this message format
        arguments - The objects to format
        Since:
        2.6
    • Method Detail

      • getFormattedMessage

        public java.lang.String getFormattedMessage()
        Returns the formatted message.
        Specified by:
        getFormattedMessage in interface Message
        Returns:
        the formatted message.
      • getFormat

        public java.lang.String getFormat()
        Returns the message pattern.
        Specified by:
        getFormat in interface Message
        Returns:
        the message pattern.
      • getParameters

        public java.lang.Object[] getParameters()
        Returns the message parameters.
        Specified by:
        getParameters in interface Message
        Returns:
        the message parameters.
      • formatMessage

        protected java.lang.String formatMessage​(java.lang.String msgPattern,
                                                 java.lang.Object... args)
      • equals

        public boolean equals​(java.lang.Object o)
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • writeObject

        private void writeObject​(java.io.ObjectOutputStream out)
                          throws java.io.IOException
        Throws:
        java.io.IOException
      • readObject

        private void readObject​(java.io.ObjectInputStream in)
                         throws java.io.IOException,
                                java.lang.ClassNotFoundException
        Throws:
        java.io.IOException
        java.lang.ClassNotFoundException
      • getThrowable

        public java.lang.Throwable getThrowable()
        Return the throwable passed to the Message.
        Specified by:
        getThrowable in interface Message
        Returns:
        the Throwable.