Package org.apache.logging.log4j.message
Class DefaultFlowMessageFactory
- java.lang.Object
-
- org.apache.logging.log4j.message.DefaultFlowMessageFactory
-
- All Implemented Interfaces:
java.io.Serializable
,FlowMessageFactory
public class DefaultFlowMessageFactory extends java.lang.Object implements FlowMessageFactory, java.io.Serializable
Default factory for flow messages.- Since:
- 2.6
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static class
DefaultFlowMessageFactory.AbstractFlowMessage
private static class
DefaultFlowMessageFactory.SimpleEntryMessage
private static class
DefaultFlowMessageFactory.SimpleExitMessage
-
Field Summary
Fields Modifier and Type Field Description private static java.lang.String
ENTRY_DEFAULT_PREFIX
private java.lang.String
entryText
private static java.lang.String
EXIT_DEFAULT_PREFIX
private java.lang.String
exitText
private MessageFactory
messageFactory
private static long
serialVersionUID
-
Constructor Summary
Constructors Constructor Description DefaultFlowMessageFactory()
Constructs a message factory with"Enter"
and"Exit"
as the default flow strings.DefaultFlowMessageFactory(java.lang.String entryText, java.lang.String exitText)
Constructs a message factory with the given entry and exit strings.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private static MessageFactory
createDefaultMessageFactory()
java.lang.String
getEntryText()
Gets the entry text.java.lang.String
getExitText()
Gets the exit text.private Message
makeImmutable(Message message)
EntryMessage
newEntryMessage(java.lang.String format, java.lang.Object... params)
Creates a new entry message based on a format string with parameters.EntryMessage
newEntryMessage(Message message)
Creates a new entry message based on an existing message.ExitMessage
newExitMessage(java.lang.Object result, EntryMessage message)
Creates a new exit message based on a return value and an existing entry message.ExitMessage
newExitMessage(java.lang.Object result, Message message)
Creates a new exit message based on a return value and an existing message.ExitMessage
newExitMessage(java.lang.String format, java.lang.Object result)
Creates a new exit message based on a return value and a forma string.ExitMessage
newExitMessage(EntryMessage message)
Creates a new exit message based on no return value and an existing entry message.ExitMessage
newExitMessage(Message message)
Creates a new exit message based on no return value and an existing message.
-
-
-
Field Detail
-
EXIT_DEFAULT_PREFIX
private static final java.lang.String EXIT_DEFAULT_PREFIX
- See Also:
- Constant Field Values
-
ENTRY_DEFAULT_PREFIX
private static final java.lang.String ENTRY_DEFAULT_PREFIX
- See Also:
- Constant Field Values
-
serialVersionUID
private static final long serialVersionUID
- See Also:
- Constant Field Values
-
entryText
private final java.lang.String entryText
-
exitText
private final java.lang.String exitText
-
messageFactory
private final MessageFactory messageFactory
-
-
Constructor Detail
-
DefaultFlowMessageFactory
public DefaultFlowMessageFactory()
Constructs a message factory with"Enter"
and"Exit"
as the default flow strings.
-
DefaultFlowMessageFactory
public DefaultFlowMessageFactory(java.lang.String entryText, java.lang.String exitText)
Constructs a message factory with the given entry and exit strings.- Parameters:
entryText
- the text to use for trace entry, like"Enter"
.exitText
- the text to use for trace exit, like"Exit"
.
-
-
Method Detail
-
createDefaultMessageFactory
private static MessageFactory createDefaultMessageFactory()
-
getEntryText
public java.lang.String getEntryText()
Gets the entry text.- Returns:
- the entry text.
-
getExitText
public java.lang.String getExitText()
Gets the exit text.- Returns:
- the exit text.
-
newEntryMessage
public EntryMessage newEntryMessage(java.lang.String format, java.lang.Object... params)
Description copied from interface:FlowMessageFactory
Creates a new entry message based on a format string with parameters.- Specified by:
newEntryMessage
in interfaceFlowMessageFactory
- Parameters:
format
- format stringparams
- parameters- Returns:
- the new entry message
-
newEntryMessage
public EntryMessage newEntryMessage(Message message)
Description copied from interface:FlowMessageFactory
Creates a new entry message based on an existing message.- Specified by:
newEntryMessage
in interfaceFlowMessageFactory
- Parameters:
message
- the original message- Returns:
- the new entry message
-
newExitMessage
public ExitMessage newExitMessage(java.lang.String format, java.lang.Object result)
Description copied from interface:FlowMessageFactory
Creates a new exit message based on a return value and a forma string.- Specified by:
newExitMessage
in interfaceFlowMessageFactory
- Parameters:
format
- a format stringresult
- the return value- Returns:
- the new exit message
-
newExitMessage
public ExitMessage newExitMessage(Message message)
Description copied from interface:FlowMessageFactory
Creates a new exit message based on no return value and an existing message.- Specified by:
newExitMessage
in interfaceFlowMessageFactory
- Parameters:
message
- the original entry message- Returns:
- the new exit message
-
newExitMessage
public ExitMessage newExitMessage(EntryMessage message)
Description copied from interface:FlowMessageFactory
Creates a new exit message based on no return value and an existing entry message.- Specified by:
newExitMessage
in interfaceFlowMessageFactory
- Parameters:
message
- the original entry message- Returns:
- the new exit message
-
newExitMessage
public ExitMessage newExitMessage(java.lang.Object result, EntryMessage message)
Description copied from interface:FlowMessageFactory
Creates a new exit message based on a return value and an existing entry message.- Specified by:
newExitMessage
in interfaceFlowMessageFactory
- Parameters:
result
- the return value.message
- the original entry message- Returns:
- the new exit message
-
newExitMessage
public ExitMessage newExitMessage(java.lang.Object result, Message message)
Description copied from interface:FlowMessageFactory
Creates a new exit message based on a return value and an existing message.- Specified by:
newExitMessage
in interfaceFlowMessageFactory
- Parameters:
result
- the return value.message
- the original message- Returns:
- the new exit message
-
-