Thread-Safety Note
the contents of this message can be modified after construction. When using asynchronous loggers and appenders it is not recommended to modify this message after the message is logged, because it is undefined whether the logged message string will contain the old values or the modified values.
This class was pulled up from StringMapMessage to allow for Objects as values.
| Modifier and Type | Class and Description |
|---|---|
| public static enum | MapMessage.
When set as the format specifier causes the Map to be formatted as XML. |
| Modifier and Type | Field and Description |
|---|---|
| private final IndexedStringMap | |
| private static final long |
| Access | Constructor and Description |
|---|---|
| public | |
| public | |
| public |
| Modifier and Type | Method and Description |
|---|---|
| protected void | |
| protected void | |
| private void | |
| protected void | |
| protected void | |
| public String | |
| public String | |
| public void | asXml(final StringBuilder
format into this builder. sb)Formats this message as an XML fragment String into the given builder. |
| public void | |
| public boolean | Returns: true if this data structure contains the specified key, false otherwisethe key whose presence to check. May be key)null.Returns |
| public boolean | equals(final Object
the reference object with which to compare. o)Overrides java. Indicates whether some other object is "equal to" this one. |
| public < type of the consumer value CV> void | forEach(final BiConsumer<String, ? super CV>
The action to be performed for each key-value pair in this collection action)Performs the given action for each key-value pair in this data structure until all entries have been processed or the action throws an exception. |
| public < type of the consumer value CV, type of the third parameter S> void | forEach(final TriConsumer<String, ? super CV, 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
triconsumer state)Performs the given action for each key-value pair in this data structure until all entries have been processed or the action throws an exception. |
| private StringBuilder | Returns: The formatted String.The format identifier. format,Formats the Structured data as described in RFC 5424. |
| public void | formatTo(final StringBuilder
the StringBuilder to write into buffer)Implements org. Writes a text representation of this object into the specified |
| public void | formatTo(final String[]
An array of Strings that provide extra information about how to format the message.
Each MultiFormatStringBuilderFormattable implementation is free to use the provided formats however they choose. formats, final StringBuilder the StringBuilder to write into buffer)Implements org. Writes a text representation of this object into the specified |
| public String | |
| public Map | Returns: the message data as an unmodifiable map.Returns the message data as an unmodifiable Map. |
| public String | Returns: the message.Implements org. Returns the message. |
| private MapMessage. | |
| public String[] | getFormats()
Implements org. Returns the supported formats. |
| public String | Returns: the formatted message.Implements org. Formats the message and return it. |
| public String | Returns: The formatted message.An array of Strings that provide extra information about how to format the message. MapMessage uses
the first format specifier it recognizes. The supported formats are XML, JSON, and JAVA. The default
format is key1="value1" key2="value2" as required by RFC
5424 messages. formats)Implements org. Returns the Message formatted as a String. |
| public IndexedReadOnlyStringMap | Returns: the read-only message data.Returns a read-only view of the message data. |
| public Object[] | Returns: the data elements.Implements org. Returns the data elements as if they were parameters on the logging event. |
| public Throwable | Returns: nullImplements org. Always returns null. |
| public int | |
| public M | Returns: A new MapMessageThe Map. map)Constructs a new instance based on an existing Map. |
| public void | |
| public void | |
| public String | |
| protected String | |
| public String | |
| protected void | |
| protected void | |
| protected void | |
| protected void | |
| protected void | |
| protected void | |
| protected void | |
| protected void | |
| protected void | |
| protected void | |
| public M | |
| public M | |
| public M | |
| public M | |
| public M | |
| public M | |
| public M | |
| public M | |
| public M | |
| public M |
| data | back to summary |
|---|---|
| private final IndexedStringMap data | |
| serialVersionUID | back to summary |
|---|---|
| private static final long serialVersionUID | |
| MapMessage | back to summary |
|---|---|
| public MapMessage() Constructs a new instance. | |
| MapMessage | back to summary |
|---|---|
| public MapMessage(final int initialCapacity) Constructs a new instance.
| |
| MapMessage | back to summary |
|---|---|
| public MapMessage(final Map<String, V> map) Constructs a new instance based on an existing | |
| appendMap | back to summary |
|---|---|
| protected void appendMap(final StringBuilder sb) | |
| asJava | back to summary |
|---|---|
| protected void asJava(final StringBuilder sb) | |
| asJava | back to summary |
|---|---|
| private void asJava(final StringBuilder sb, final boolean quoted) | |
| asJavaUnquoted | back to summary |
|---|---|
| protected void asJavaUnquoted(final StringBuilder sb) | |
| asJson | back to summary |
|---|---|
| protected void asJson(final StringBuilder sb) | |
| asString | back to summary |
|---|---|
| public String asString() Formats the Structured data as described in RFC 5424.
| |
| asString | back to summary |
|---|---|
| public String asString(final String format) Formats the Structured data as described in RFC 5424. | |
| asXml | back to summary |
|---|---|
| public void asXml(final StringBuilder sb) Formats this message as an XML fragment String into the given builder.
| |
| clear | back to summary |
|---|---|
| public void clear() Clear the data. | |
| containsKey | back to summary |
|---|---|
| public boolean containsKey(final String key) Returns
| |
| equals | back to summary |
|---|---|
| public boolean equals(final Object o) Overrides java. Doc from java. Indicates whether some other object is "equal to" this one.
The
An equivalence relation partitions the elements it operates on into equivalence classes; all the members of an equivalence class are equal to each other. Members of an equivalence class are substitutable for each other, at least for some purposes. | |
| forEach | back to summary |
|---|---|
| public <CV> void forEach(final BiConsumer<String, ? super CV> action) Performs the given action for each key-value pair in this data structure until all entries have been processed or the action throws an exception.
Some implementations may not support structural modifications (adding new elements or removing elements) while
iterating over the contents. In such implementations, attempts to add or remove elements from the
| |
| forEach | back to summary |
|---|---|
| public <CV, S> void forEach(final TriConsumer<String, ? super CV, S> action, final S state) Performs the given action for each key-value pair in this data structure until all entries have been processed or the action throws an exception. The third 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.
Some implementations may not support structural modifications (adding new elements or removing elements) while
iterating over the contents. In such implementations, attempts to add or remove elements from the
| |
| format | back to summary |
|---|---|
| private StringBuilder format(final MapMessage. Formats the Structured data as described in RFC 5424.
| |
| formatTo | back to summary |
|---|---|
| public void formatTo(final StringBuilder buffer) Implements org. Doc from org. Writes a text representation of this object into the specified
| |
| formatTo | back to summary |
|---|---|
| public void formatTo(final String[] formats, final StringBuilder buffer) Implements org. Doc from org. Writes a text representation of this object into the specified
| |
| get | back to summary |
|---|---|
| public String get(final String key) Retrieves the value of the element with the specified key or null if the key is not present. | |
| getData | back to summary |
|---|---|
| public Map Returns the message data as an unmodifiable Map.
| |
| getFormat | back to summary |
|---|---|
| public String getFormat() Implements org. Returns the message. | |
| getFormat | back to summary |
|---|---|
| private MapMessage. | |
| getFormats | back to summary |
|---|---|
| public String[] getFormats() Implements org. Doc from org. Returns the supported formats. | |
| getFormattedMessage | back to summary |
|---|---|
| public String getFormattedMessage() Implements org. Formats the message and return it. | |
| getFormattedMessage | back to summary |
|---|---|
| public String getFormattedMessage(final String[] formats) Implements org. Doc from org. Returns the Message formatted as a String.
| |
| getIndexedReadOnlyStringMap | back to summary |
|---|---|
| public IndexedReadOnlyStringMap getIndexedReadOnlyStringMap() Returns a read-only view of the message data.
| |
| getParameters | back to summary |
|---|---|
| public Object[] getParameters() Implements org. Returns the data elements as if they were parameters on the logging event. | |
| getThrowable | back to summary |
|---|---|
| public Throwable getThrowable() Implements org. Always returns null. | |
| hashCode | back to summary |
|---|---|
| public int hashCode() Overrides java. Doc from java. Returns a hash code value for this object. This method is
supported for the benefit of hash tables such as those provided by
The general contract of
| |
| newInstance | back to summary |
|---|---|
| public M newInstance(final Map<String, V> map) Constructs a new instance based on an existing Map.
| |
| put | back to summary |
|---|---|
| public void put(final String candidateKey, final String value) Adds an item to the data Map. | |
| putAll | back to summary |
|---|---|
| public void putAll(final Map<String, String> map) Adds all the elements from the specified Map. | |
| remove | back to summary |
|---|---|
| public String remove(final String key) Removes the element with the specified name. | |
| toKey | back to summary |
|---|---|
| protected String toKey(final String candidateKey) Allows subclasses to change a candidate key to an actual key. | |
| toString | back to summary |
|---|---|
| public String toString() Overrides java. Doc from java. Returns a string representation of the object.
Satisfying this method's contract implies a non- | |
| validate | back to summary |
|---|---|
| protected void validate(final String key, final boolean value) Default implementation does nothing.
| |
| validate | back to summary |
|---|---|
| protected void validate(final String key, final byte value) Default implementation does nothing.
| |
| validate | back to summary |
|---|---|
| protected void validate(final String key, final char value) Default implementation does nothing.
| |
| validate | back to summary |
|---|---|
| protected void validate(final String key, final double value) Default implementation does nothing.
| |
| validate | back to summary |
|---|---|
| protected void validate(final String key, final float value) Default implementation does nothing.
| |
| validate | back to summary |
|---|---|
| protected void validate(final String key, final int value) Default implementation does nothing.
| |
| validate | back to summary |
|---|---|
| protected void validate(final String key, final long value) Default implementation does nothing.
| |
| validate | back to summary |
|---|---|
| protected void validate(final String key, final Object value) Default implementation does nothing.
| |
| validate | back to summary |
|---|---|
| protected void validate(final String key, final short value) Default implementation does nothing.
| |
| validate | back to summary |
|---|---|
| protected void validate(final String key, final String value) Default implementation does nothing.
| |
| with | back to summary |
|---|---|
| public M with(final String candidateKey, final boolean value) Adds an item to the data Map.
| |
| with | back to summary |
|---|---|
| public M with(final String candidateKey, final byte value) Adds an item to the data Map.
| |
| with | back to summary |
|---|---|
| public M with(final String candidateKey, final char value) Adds an item to the data Map.
| |
| with | back to summary |
|---|---|
| public M with(final String candidateKey, final double value) Adds an item to the data Map.
| |
| with | back to summary |
|---|---|
| public M with(final String candidateKey, final float value) Adds an item to the data Map.
| |
| with | back to summary |
|---|---|
| public M with(final String candidateKey, final int value) Adds an item to the data Map.
| |
| with | back to summary |
|---|---|
| public M with(final String candidateKey, final long value) Adds an item to the data Map.
| |
| with | back to summary |
|---|---|
| public M with(final String candidateKey, final Object value) Adds an item to the data Map.
| |
| with | back to summary |
|---|---|
| public M with(final String candidateKey, final short value) Adds an item to the data Map.
| |
| with | back to summary |
|---|---|
| public M with(final String candidateKey, final String value) Adds an item to the data Map in fluent style.
| |
| Modifier and Type | Field and Description |
|---|---|
| public static final MapMessage. | JAVA
The map should be formatted the same as documented by |
| public static final MapMessage. | JAVA_UNQUOTED
The map should be formatted the same as documented by |
| public static final MapMessage. | JSON
The map should be formatted as JSON. |
| public static final MapMessage. | XML
The map should be formatted as XML. |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| public static MapMessage. | Returns: a MapFormata MapFormat name format)Maps a format name to an |
| public static String[] | |
| public static MapMessage. | |
| public static MapMessage. |
| JAVA | back to summary |
|---|---|
| public static final MapMessage. The map should be formatted the same as documented by | |
| JAVA_UNQUOTED | back to summary |
|---|---|
| public static final MapMessage. The map should be formatted the same as documented by
| |
| JSON | back to summary |
|---|---|
| public static final MapMessage. The map should be formatted as JSON. | |
| XML | back to summary |
|---|---|
| public static final MapMessage. The map should be formatted as XML. | |
| MapFormat | back to summary |
|---|---|
| private MapFormat() | |
| lookupIgnoreCase | back to summary |
|---|---|
| public static MapMessage. Maps a format name to an
| |
| names | back to summary |
|---|---|
| public static String[] names() All
| |
| valueOf | back to summary |
|---|---|
| public static MapMessage. | |
| values | back to summary |
|---|---|
| public static MapMessage. | |