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:
-
Constructor Summary
ConstructorDescriptionBasic constructor.SimpleMessage
(CharSequence charSequence) Constructor that includes the message.SimpleMessage
(String message) Constructor that includes the message. -
Method Summary
Modifier and TypeMethodDescriptionchar
charAt
(int index) boolean
void
formatTo
(StringBuilder buffer) Writes a text representation of this object into the specifiedStringBuilder
, ideally without allocating temporary objects.Returns the message.Returns the message.Object[]
Returns null since there are no parameters.Always returns null.int
hashCode()
int
length()
subSequence
(int start, int end) 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 Details
-
SimpleMessage
public SimpleMessage()Basic constructor. -
SimpleMessage
Constructor that includes the message.- Parameters:
message
- The String message.
-
SimpleMessage
Constructor that includes the message.- Parameters:
charSequence
- The CharSequence message.
-
-
Method Details
-
getFormattedMessage
Returns the message.- Specified by:
getFormattedMessage
in interfaceMessage
- Returns:
- the message.
-
formatTo
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
Returns the message. -
getParameters
Returns null since there are no parameters.- Specified by:
getParameters
in interfaceMessage
- Returns:
- null.
-
equals
-
hashCode
public int hashCode() -
toString
- Specified by:
toString
in interfaceCharSequence
- Overrides:
toString
in classObject
-
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
- Specified by:
subSequence
in interfaceCharSequence
-