Package org.apache.logging.log4j.message
Class ObjectMessage
- java.lang.Object
-
- org.apache.logging.log4j.message.ObjectMessage
-
- All Implemented Interfaces:
Serializable,Message,StringBuilderFormattable
public class ObjectMessage extends Object implements Message, StringBuilderFormattable
Handles messages that contain an Object.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description ObjectMessage(Object obj)Creates the ObjectMessage.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(Object o)voidformatTo(StringBuilder buffer)Writes a text representation of this object into the specifiedStringBuilder, ideally without allocating temporary objects.StringgetFormat()Returns the object formatted using its toString method.StringgetFormattedMessage()Returns the formatted object message.ObjectgetParameter()Returns the object parameter.Object[]getParameters()Returns the object as if it were a parameter.ThrowablegetThrowable()Gets the message if it is a throwable.inthashCode()StringtoString()
-
-
-
Constructor Detail
-
ObjectMessage
public ObjectMessage(Object obj)
Creates the ObjectMessage.- Parameters:
obj- The Object to format.
-
-
Method Detail
-
getFormattedMessage
public String getFormattedMessage()
Returns the formatted object message.- Specified by:
getFormattedMessagein interfaceMessage- Returns:
- the formatted object message.
-
formatTo
public void formatTo(StringBuilder buffer)
Description copied from interface:StringBuilderFormattableWrites a text representation of this object into the specifiedStringBuilder, ideally without allocating temporary objects.- Specified by:
formatToin interfaceStringBuilderFormattable- Parameters:
buffer- the StringBuilder to write into
-
getFormat
public String getFormat()
Returns the object formatted using its toString method.
-
getParameter
public Object getParameter()
Returns the object parameter.- Returns:
- The object.
- Since:
- 2.7
-
getParameters
public Object[] getParameters()
Returns the object as if it were a parameter.- Specified by:
getParametersin interfaceMessage- Returns:
- The object.
-
getThrowable
public Throwable getThrowable()
Gets the message if it is a throwable.- Specified by:
getThrowablein interfaceMessage- Returns:
- the message if it is a throwable.
-
-