Top Description Fields Constructors Methods
org.apache.logging.log4j.message

public Class ReusableObjectMessage

extends Object
implements ReusableMessage, ParameterVisitable, Clearable
Class Inheritance
All Implemented Interfaces
org.apache.logging.log4j.message.Clearable, org.apache.logging.log4j.message.ParameterVisitable, org.apache.logging.log4j.message.ReusableMessage, org.apache.logging.log4j.util.StringBuilderFormattable, org.apache.logging.log4j.message.Message, java.io.Serializable
Annotations
@PerformanceSensitive:allocation
Imports
org.apache.logging.log4j.util.PerformanceSensitive, .StringBuilders

Mutable Message wrapper around an Object message.
Since
2.6

Field Summary

Modifier and TypeField and Description
private transient Object
private static final long

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public void
clear()

Implements org.apache.logging.log4j.message.Clearable.clear.

Resets the object to a clean state.

public <S> void
forEachParameter(final ParameterConsumer<S>
The action to be performed for each key-value pair in this collection
action
,
final S
the object to be passed as the third parameter to each invocation on the specified ParameterConsumer.
state
)

Implements org.apache.logging.log4j.message.ParameterVisitable.forEachParameter.

Performs the given action for each parameter until all values have been processed or the action throws an exception.

public void
formatTo(final StringBuilder
the StringBuilder to write into
buffer
)

Implements org.apache.logging.log4j.util.StringBuilderFormattable.formatTo.

Writes a text representation of this object into the specified StringBuilder, ideally without allocating temporary objects.

public String

Returns:

the String representation of the object.
getFormat
()

Implements org.apache.logging.log4j.message.Message.getFormat.

Returns the object formatted using its toString method.

public String

Returns:

the formatted object message.
getFormattedMessage
()

Implements org.apache.logging.log4j.message.Message.getFormattedMessage.

Returns the formatted object message.

public Object

Returns:

The object.
getParameter
()

Returns the object parameter.

public short

Returns:

1
getParameterCount
()

Implements org.apache.logging.log4j.message.ReusableMessage.getParameterCount.

This message has exactly one parameter (the object), so always returns one.

public Object[]

Returns:

The object.
getParameters
()

Implements org.apache.logging.log4j.message.Message.getParameters.

Returns the object as if it were a parameter.

public Throwable

Returns:

the message if it is a throwable.
getThrowable
()

Implements org.apache.logging.log4j.message.Message.getThrowable.

Gets the message if it is a throwable.

public Message
memento()

Implements org.apache.logging.log4j.message.ReusableMessage.memento.

Returns an immutable snapshot of the current internal state of this reusable message.

public void
set(final Object object)

public Object[]

Returns:

the specified array
swapParameters
(final Object[]
the parameter array to return
emptyReplacement
)

Implements org.apache.logging.log4j.message.ReusableMessage.swapParameters.

This message has exactly one parameter (the object), so returns it as the first parameter in the array.

public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.

private Object
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Field Detail

objback to summary
private transient Object obj
serialVersionUIDback to summary
private static final long serialVersionUID

Constructor Detail

ReusableObjectMessageback to summary
public ReusableObjectMessage()

Method Detail

clearback to summary
public void clear()

Implements org.apache.logging.log4j.message.Clearable.clear.

Doc from org.apache.logging.log4j.message.Clearable.clear.

Resets the object to a clean state.

Annotations
@Override
forEachParameterback to summary
public <S> void forEachParameter(final ParameterConsumer<S> action, final S state)

Implements org.apache.logging.log4j.message.ParameterVisitable.forEachParameter.

Doc from org.apache.logging.log4j.message.ParameterVisitable.forEachParameter.

Performs the given action for each parameter until all values have been processed or the action throws an exception.

The second parameter lets callers pass in a stateful object to be modified with the key-value pairs, so the TriConsumer implementation itself can be stateless and potentially reusable.

Parameters
<S>
type of the third parameter
action:ParameterConsumer<S>

The action to be performed for each key-value pair in this collection

state:S

the object to be passed as the third parameter to each invocation on the specified ParameterConsumer.

Annotations
@Override
formatToback to summary
public void formatTo(final StringBuilder buffer)

Implements org.apache.logging.log4j.util.StringBuilderFormattable.formatTo.

Doc from org.apache.logging.log4j.util.StringBuilderFormattable.formatTo.

Writes a text representation of this object into the specified StringBuilder, ideally without allocating temporary objects.

Parameters
buffer:StringBuilder

the StringBuilder to write into

Annotations
@Override
getFormatback to summary
public String getFormat()

Implements org.apache.logging.log4j.message.Message.getFormat.

Returns the object formatted using its toString method.

Returns:String

the String representation of the object.

Annotations
@Override
getFormattedMessageback to summary
public String getFormattedMessage()

Implements org.apache.logging.log4j.message.Message.getFormattedMessage.

Returns the formatted object message.

Returns:String

the formatted object message.

Annotations
@Override
getParameterback to summary
public Object getParameter()

Returns the object parameter.

Returns:Object

The object.

Since
2.7
getParameterCountback to summary
public short getParameterCount()

Implements org.apache.logging.log4j.message.ReusableMessage.getParameterCount.

This message has exactly one parameter (the object), so always returns one.

Returns:short

1

Annotations
@Override
getParametersback to summary
public Object[] getParameters()

Implements org.apache.logging.log4j.message.Message.getParameters.

Returns the object as if it were a parameter.

Returns:Object[]

The object.

Annotations
@Override
getThrowableback to summary
public Throwable getThrowable()

Implements org.apache.logging.log4j.message.Message.getThrowable.

Gets the message if it is a throwable.

Returns:Throwable

the message if it is a throwable.

Annotations
@Override
mementoback to summary
public Message memento()

Implements org.apache.logging.log4j.message.ReusableMessage.memento.

Doc from org.apache.logging.log4j.message.ReusableMessage.memento.

Returns an immutable snapshot of the current internal state of this reusable message. The returned snapshot will not be affected by subsequent modifications of this reusable message.

Returns:Message

an immutable snapshot of this message

Annotations
@Override
setback to summary
public void set(final Object object)
swapParametersback to summary
public Object[] swapParameters(final Object[] emptyReplacement)

Implements org.apache.logging.log4j.message.ReusableMessage.swapParameters.

This message has exactly one parameter (the object), so returns it as the first parameter in the array.

Parameters
emptyReplacement:Object[]

the parameter array to return

Returns:Object[]

the specified array

Annotations
@Override
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object. Satisfying this method's contract implies a non-null result must be returned.

Returns:String

a string representation of the object

Annotations
@Override
writeReplaceback to summary
private Object writeReplace()