Class StringFormattedMessage

java.lang.Object
org.apache.logging.log4j.message.StringFormattedMessage
All Implemented Interfaces:
Serializable, Message

public class StringFormattedMessage extends 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:
  • Constructor Details

    • StringFormattedMessage

      public StringFormattedMessage(Locale locale, String messagePattern, 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(String messagePattern, Object... arguments)
      Constructs a message.
      Parameters:
      messagePattern - the pattern for this message format
      arguments - The objects to format
      Since:
      2.6
  • Method Details

    • getFormattedMessage

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

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

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

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

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

      public String toString()
      Overrides:
      toString in class Object
    • getThrowable

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