Package org.apache.logging.log4j.message
Class SimpleMessage
- java.lang.Object
-
- org.apache.logging.log4j.message.SimpleMessage
-
- All Implemented Interfaces:
java.io.Serializable
,java.lang.CharSequence
,Message
,StringBuilderFormattable
public class SimpleMessage extends java.lang.Object implements Message, StringBuilderFormattable, java.lang.CharSequence
The simplest possible implementation of Message. It just returns the String given as the constructor argument.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description private java.lang.CharSequence
charSequence
private java.lang.String
message
private static long
serialVersionUID
-
Constructor Summary
Constructors Constructor Description SimpleMessage()
Basic constructor.SimpleMessage(java.lang.CharSequence charSequence)
Constructor that includes the message.SimpleMessage(java.lang.String message)
Constructor that includes the message.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description char
charAt(int index)
boolean
equals(java.lang.Object o)
void
formatTo(java.lang.StringBuilder buffer)
Writes a text representation of this object into the specifiedStringBuilder
, ideally without allocating temporary objects.java.lang.String
getFormat()
Returns the message.java.lang.String
getFormattedMessage()
Returns the message.java.lang.Object[]
getParameters()
Returns null since there are no parameters.java.lang.Throwable
getThrowable()
Always returns null.int
hashCode()
int
length()
private void
readObject(java.io.ObjectInputStream in)
java.lang.CharSequence
subSequence(int start, int end)
java.lang.String
toString()
private void
writeObject(java.io.ObjectOutputStream out)
-
-
-
Field Detail
-
serialVersionUID
private static final long serialVersionUID
- See Also:
- Constant Field Values
-
message
private java.lang.String message
-
charSequence
private transient java.lang.CharSequence charSequence
-
-
Constructor Detail
-
SimpleMessage
public SimpleMessage()
Basic constructor.
-
SimpleMessage
public SimpleMessage(java.lang.String message)
Constructor that includes the message.- Parameters:
message
- The String message.
-
SimpleMessage
public SimpleMessage(java.lang.CharSequence charSequence)
Constructor that includes the message.- Parameters:
charSequence
- The CharSequence message.
-
-
Method Detail
-
getFormattedMessage
public java.lang.String getFormattedMessage()
Returns the message.- Specified by:
getFormattedMessage
in interfaceMessage
- Returns:
- the message.
-
formatTo
public void formatTo(java.lang.StringBuilder buffer)
Description copied from interface:StringBuilderFormattable
Writes a text representation of this object into the specifiedStringBuilder
, ideally without allocating temporary objects.- Specified by:
formatTo
in interfaceStringBuilderFormattable
- Parameters:
buffer
- the StringBuilder to write into
-
getFormat
public java.lang.String getFormat()
Returns the message.
-
getParameters
public java.lang.Object[] getParameters()
Returns null since there are no parameters.- Specified by:
getParameters
in interfaceMessage
- Returns:
- null.
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equals
in classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
toString
public java.lang.String toString()
- Specified by:
toString
in interfacejava.lang.CharSequence
- Overrides:
toString
in classjava.lang.Object
-
getThrowable
public java.lang.Throwable getThrowable()
Always returns null.- Specified by:
getThrowable
in interfaceMessage
- Returns:
- null
-
length
public int length()
- Specified by:
length
in interfacejava.lang.CharSequence
-
charAt
public char charAt(int index)
- Specified by:
charAt
in interfacejava.lang.CharSequence
-
subSequence
public java.lang.CharSequence subSequence(int start, int end)
- Specified by:
subSequence
in interfacejava.lang.CharSequence
-
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
-
-