public class ReusableObjectMessage extends Object implements ReusableMessage, ParameterVisitable
| Constructor and Description |
|---|
ReusableObjectMessage() |
| Modifier and Type | Method and Description |
|---|---|
void |
clear()
Resets the object to a clean state.
|
<S> void |
forEachParameter(ParameterConsumer<S> action,
S state)
Performs the given action for each parameter until all values
have been processed or the action throws an exception.
|
void |
formatTo(StringBuilder buffer)
Writes a text representation of this object into the specified
StringBuilder, ideally without allocating
temporary objects. |
String |
getFormat()
Returns the object formatted using its toString method.
|
String |
getFormattedMessage()
Returns the formatted object message.
|
Object |
getParameter()
Returns the object parameter.
|
short |
getParameterCount()
This message has exactly one parameter (the object), so always returns one.
|
Object[] |
getParameters()
Returns the object as if it were a parameter.
|
Throwable |
getThrowable()
Gets the message if it is a throwable.
|
Message |
memento()
Returns an immutable snapshot of the current internal state of this reusable message.
|
void |
set(Object object) |
Object[] |
swapParameters(Object[] emptyReplacement)
This message has exactly one parameter (the object), so returns it as the first parameter in the array.
|
String |
toString() |
public void set(Object object)
public String getFormattedMessage()
getFormattedMessage in interface Messagepublic void formatTo(StringBuilder buffer)
StringBuilderFormattableStringBuilder, ideally without allocating
temporary objects.formatTo in interface StringBuilderFormattablebuffer - the StringBuilder to write intopublic String getFormat()
public Object getParameter()
public Object[] getParameters()
getParameters in interface Messagepublic Throwable getThrowable()
getThrowable in interface Messagepublic Object[] swapParameters(Object[] emptyReplacement)
swapParameters in interface ReusableMessageemptyReplacement - the parameter array to returnReusableMessage.getParameterCount()public short getParameterCount()
getParameterCount in interface ReusableMessagepublic <S> void forEachParameter(ParameterConsumer<S> action, S state)
ParameterVisitableThe 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.
forEachParameter in interface ParameterVisitableS - type of the third parameteraction - The action to be performed for each key-value pair in this collectionstate - the object to be passed as the third parameter to each invocation on the
specified ParameterConsumer.public Message memento()
ReusableMessagememento in interface ReusableMessagepublic void clear()
Copyright © 2022 JBoss by Red Hat. All rights reserved.