Package org.apache.logging.log4j.message
Class ObjectMessage
- java.lang.Object
-
- org.apache.logging.log4j.message.ObjectMessage
-
- All Implemented Interfaces:
java.io.Serializable,Message,StringBuilderFormattable
public class ObjectMessage extends java.lang.Object implements Message, StringBuilderFormattable
Handles messages that contain an Object.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description private java.lang.Objectobjprivate java.lang.StringobjectStringprivate static longserialVersionUID
-
Constructor Summary
Constructors Constructor Description ObjectMessage(java.lang.Object obj)Creates the ObjectMessage.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private booleanequalObjectsOrStrings(java.lang.Object left, java.lang.Object right)booleanequals(java.lang.Object o)voidformatTo(java.lang.StringBuilder buffer)Writes a text representation of this object into the specifiedStringBuilder, ideally without allocating temporary objects.java.lang.StringgetFormat()Returns the object formatted using its toString method.java.lang.StringgetFormattedMessage()Returns the formatted object message.java.lang.ObjectgetParameter()Returns the object parameter.java.lang.Object[]getParameters()Returns the object as if it were a parameter.java.lang.ThrowablegetThrowable()Gets the message if it is a throwable.inthashCode()private voidreadObject(java.io.ObjectInputStream in)java.lang.StringtoString()private voidwriteObject(java.io.ObjectOutputStream out)
-
-
-
Field Detail
-
serialVersionUID
private static final long serialVersionUID
- See Also:
- Constant Field Values
-
obj
private transient java.lang.Object obj
-
objectString
private transient java.lang.String objectString
-
-
Method Detail
-
getFormattedMessage
public java.lang.String getFormattedMessage()
Returns the formatted object message.- Specified by:
getFormattedMessagein interfaceMessage- Returns:
- the formatted object message.
-
formatTo
public void formatTo(java.lang.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 java.lang.String getFormat()
Returns the object formatted using its toString method.
-
getParameter
public java.lang.Object getParameter()
Returns the object parameter.- Returns:
- The object.
- Since:
- 2.7
-
getParameters
public java.lang.Object[] getParameters()
Returns the object as if it were a parameter.- Specified by:
getParametersin interfaceMessage- Returns:
- The object.
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equalsin classjava.lang.Object
-
equalObjectsOrStrings
private boolean equalObjectsOrStrings(java.lang.Object left, java.lang.Object right)
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.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.IOExceptionjava.lang.ClassNotFoundException
-
getThrowable
public java.lang.Throwable getThrowable()
Gets the message if it is a throwable.- Specified by:
getThrowablein interfaceMessage- Returns:
- the message if it is a throwable.
-
-