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

public Class StructuredDataCollectionMessage

extends Object
implements StringBuilderFormattable, MessageCollectionMessage<StructuredDataMessage>
Class Inheritance
All Implemented Interfaces
org.apache.logging.log4j.message.MessageCollectionMessage, java.lang.Iterable, org.apache.logging.log4j.message.Message, java.io.Serializable, org.apache.logging.log4j.util.StringBuilderFormattable
Imports
java.util.ArrayList, .Iterator, .List, org.apache.logging.log4j.util.StringBuilderFormattable

A collection of StructuredDataMessages.

Field Summary

Modifier and TypeField and Description
private static final long
private final List<StructuredDataMessage>

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
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
getFormat()

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

Gets the format portion of the Message.

public String
getFormattedMessage()

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

Gets the Message formatted as a String.

public Object[]
getParameters()

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

Gets parameter values, if any.

public Throwable
public Iterator<StructuredDataMessage>
iterator()

Implements java.lang.Iterable.iterator.

Returns an iterator over elements of type T.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

serialVersionUIDback to summary
private static final long serialVersionUID
structuredDataMessageListback to summary
private final List<StructuredDataMessage> structuredDataMessageList

Constructor Detail

StructuredDataCollectionMessageback to summary
public StructuredDataCollectionMessage(final List<StructuredDataMessage> messages)

Method Detail

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.

Doc from org.apache.logging.log4j.message.Message.getFormat.

Gets the format portion of the Message.

Returns:String

The message format. Some implementations, such as ParameterizedMessage, will use this as the message "pattern". Other Messages may simply return an empty String. TODO Do all messages have a format? What syntax? Using a Formatter object could be cleaner. (RG) In SimpleMessage the format is identical to the formatted message. In ParameterizedMessage and StructuredDataMessage it is not. It is up to the Message implementer to determine what this method will return. A Formatter is inappropriate as this is very specific to the Message implementation so it isn't clear to me how having a Formatter separate from the Message would be cleaner.

Annotations
@Override
getFormattedMessageback to summary
public String getFormattedMessage()

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

Doc from org.apache.logging.log4j.message.Message.getFormattedMessage.

Gets the Message formatted as a String. Each Message implementation determines the appropriate way to format the data encapsulated in the Message. Messages that provide more than one way of formatting the Message will implement MultiformatMessage.

When configured to log asynchronously, this method is called before the Message is queued, unless this message implements ReusableMessage or is annotated with AsynchronouslyFormattable. This gives the Message implementation class a chance to create a formatted message String with the current value of any mutable objects. The intention is that the Message implementation caches this formatted message and returns it on subsequent calls. (See LOG4J2-763.)

When logging synchronously, this method will not be called for Messages that implement the StringBuilderFormattable interface: instead, the formatTo(StringBuilder) method will be called so the Message can format its contents without creating intermediate String objects.

Returns:String

The message String.

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

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

Doc from org.apache.logging.log4j.message.Message.getParameters.

Gets parameter values, if any.

Returns:Object[]

An array of parameter values or null.

Annotations
@Override
getThrowableback to summary
public Throwable getThrowable()

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

Doc from org.apache.logging.log4j.message.Message.getThrowable.

Gets the throwable, if any.

Returns:Throwable

the throwable or null.

Annotations
@Override
iteratorback to summary
public Iterator<StructuredDataMessage> iterator()

Implements java.lang.Iterable.iterator.

Doc from java.lang.Iterable.iterator.

Returns an iterator over elements of type T.

Returns:Iterator<StructuredDataMessage>

an Iterator.

Annotations
@Override