Package org.apache.logging.log4j.message
Class FormattedMessage
- java.lang.Object
- 
- org.apache.logging.log4j.message.FormattedMessage
 
- 
- All Implemented Interfaces:
- Serializable,- Message
 
 public class FormattedMessage extends Object implements Message Handles messages that contain a format String. Dynamically determines if the format conforms to MessageFormat or String.format and if not then uses ParameterizedMessage to format.- See Also:
- Serialized Form
 
- 
- 
Constructor SummaryConstructors Constructor Description FormattedMessage(String messagePattern, Object arg)Constructs with a pattern and a single parameter.FormattedMessage(String messagePattern, Object... arguments)Constructs with a pattern and a parameter array.FormattedMessage(String messagePattern, Object[] arguments, Throwable throwable)Constructs with a pattern, a parameter array, and a throwable.FormattedMessage(String messagePattern, Object arg1, Object arg2)Constructs with a pattern and two parameters.FormattedMessage(Locale locale, String messagePattern, Object arg)Constructs with a locale, a pattern and a single parameter.FormattedMessage(Locale locale, String messagePattern, Object... arguments)Constructs with a locale, a pattern and a parameter array.FormattedMessage(Locale locale, String messagePattern, Object[] arguments, Throwable throwable)Constructs with a locale, a pattern, a parameter array, and a throwable.FormattedMessage(Locale locale, String messagePattern, Object arg1, Object arg2)Constructs with a locale, a pattern and two parameters.
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(Object o)StringgetFormat()Gets the message pattern.StringgetFormattedMessage()Gets the formatted message.protected MessagegetMessage(String msgPattern, Object[] args, Throwable aThrowable)Object[]getParameters()Gets the message parameters.ThrowablegetThrowable()Gets the throwable, if any.inthashCode()StringtoString()
 
- 
- 
- 
Constructor Detail- 
FormattedMessagepublic FormattedMessage(Locale locale, String messagePattern, Object arg) Constructs with a locale, a pattern and a single parameter.- Parameters:
- locale- The locale
- messagePattern- The message pattern.
- arg- The parameter.
- Since:
- 2.6
 
 - 
FormattedMessagepublic FormattedMessage(Locale locale, String messagePattern, Object arg1, Object arg2) Constructs with a locale, a pattern and two parameters.- Parameters:
- locale- The locale
- messagePattern- The message pattern.
- arg1- The first parameter.
- arg2- The second parameter.
- Since:
- 2.6
 
 - 
FormattedMessagepublic FormattedMessage(Locale locale, String messagePattern, Object... arguments) Constructs with a locale, a pattern and a parameter array.- Parameters:
- locale- The locale
- messagePattern- The message pattern.
- arguments- The parameter.
- Since:
- 2.6
 
 - 
FormattedMessagepublic FormattedMessage(Locale locale, String messagePattern, Object[] arguments, Throwable throwable) Constructs with a locale, a pattern, a parameter array, and a throwable.- Parameters:
- locale- The Locale
- messagePattern- The message pattern.
- arguments- The parameter.
- throwable- The throwable
- Since:
- 2.6
 
 - 
FormattedMessagepublic FormattedMessage(String messagePattern, Object arg) Constructs with a pattern and a single parameter.- Parameters:
- messagePattern- The message pattern.
- arg- The parameter.
 
 - 
FormattedMessagepublic FormattedMessage(String messagePattern, Object arg1, Object arg2) Constructs with a pattern and two parameters.- Parameters:
- messagePattern- The message pattern.
- arg1- The first parameter.
- arg2- The second parameter.
 
 - 
FormattedMessagepublic FormattedMessage(String messagePattern, Object... arguments) Constructs with a pattern and a parameter array.- Parameters:
- messagePattern- The message pattern.
- arguments- The parameter.
 
 
- 
 - 
Method Detail- 
getFormatpublic String getFormat() Gets the message pattern.
 - 
getFormattedMessagepublic String getFormattedMessage() Gets the formatted message.- Specified by:
- getFormattedMessagein interface- Message
- Returns:
- the formatted message.
 
 - 
getParameterspublic Object[] getParameters() Gets the message parameters.- Specified by:
- getParametersin interface- Message
- Returns:
- the message parameters.
 
 - 
getThrowablepublic Throwable getThrowable() Description copied from interface:MessageGets the throwable, if any.- Specified by:
- getThrowablein interface- Message
- Returns:
- the throwable or null.
 
 
- 
 
-