Package org.apache.logging.log4j.message
Class SimpleMessage
- java.lang.Object
-
- org.apache.logging.log4j.message.SimpleMessage
-
- All Implemented Interfaces:
Serializable
,CharSequence
,Message
,StringBuilderFormattable
public class SimpleMessage extends Object implements Message, StringBuilderFormattable, CharSequence
The simplest possible implementation of Message. It just returns the String given as the constructor argument.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description SimpleMessage()
Basic constructor.SimpleMessage(CharSequence charSequence)
Constructor that includes the message.SimpleMessage(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(Object o)
void
formatTo(StringBuilder buffer)
Writes a text representation of this object into the specifiedStringBuilder
, ideally without allocating temporary objects.String
getFormat()
Returns the message.String
getFormattedMessage()
Returns the message.Object[]
getParameters()
Returns null since there are no parameters.Throwable
getThrowable()
Always returns null.int
hashCode()
int
length()
CharSequence
subSequence(int start, int end)
String
toString()
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface java.lang.CharSequence
chars, codePoints
-
-
-
-
Constructor Detail
-
SimpleMessage
public SimpleMessage()
Basic constructor.
-
SimpleMessage
public SimpleMessage(String message)
Constructor that includes the message.- Parameters:
message
- The String message.
-
SimpleMessage
public SimpleMessage(CharSequence charSequence)
Constructor that includes the message.- Parameters:
charSequence
- The CharSequence message.
-
-
Method Detail
-
getFormattedMessage
public String getFormattedMessage()
Returns the message.- Specified by:
getFormattedMessage
in interfaceMessage
- Returns:
- the message.
-
formatTo
public void formatTo(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 String getFormat()
Returns the message.
-
getParameters
public Object[] getParameters()
Returns null since there are no parameters.- Specified by:
getParameters
in interfaceMessage
- Returns:
- null.
-
toString
public String toString()
- Specified by:
toString
in interfaceCharSequence
- Overrides:
toString
in classObject
-
getThrowable
public Throwable getThrowable()
Always returns null.- Specified by:
getThrowable
in interfaceMessage
- Returns:
- null
-
length
public int length()
- Specified by:
length
in interfaceCharSequence
-
charAt
public char charAt(int index)
- Specified by:
charAt
in interfaceCharSequence
-
subSequence
public CharSequence subSequence(int start, int end)
- Specified by:
subSequence
in interfaceCharSequence
-
-