Package org.jboss.logmanager.formatters
Interface StructuredFormatter.Generator
- Enclosing class:
- StructuredFormatter
protected static interface StructuredFormatter.Generator
A generator used to create the structured output.
-
Method Summary
Modifier and TypeMethodDescriptiondefault StructuredFormatter.Generator
Writes an integer value.default StructuredFormatter.Generator
Writes a long value.Writes a string value.Writes a map valuedefault StructuredFormatter.Generator
addAttribute
(String name, int value) Writes an attribute.default StructuredFormatter.Generator
addAttribute
(String name, String value) Writes an attribute.default StructuredFormatter.Generator
addMetaData
(Map<String, String> metaData) Adds the meta data to the structured format.default StructuredFormatter.Generator
begin()
Initial method invoked at the start of the generation.end()
Writes any trailing data that's needed.default StructuredFormatter.Generator
endArray()
Writes an end for an array.Writes an end to the object.default StructuredFormatter.Generator
startArray
(String key) Writes the start of an array.startObject
(String key) Writes the start of an object.default boolean
Indicates whether or not elements in an array should be wrapped or not.
-
Method Details
-
begin
Initial method invoked at the start of the generation.- Returns:
- the generator
- Throws:
Exception
- if an error occurs while adding the data
-
add
Writes an integer value.- Parameters:
key
- they keyvalue
- the value- Returns:
- the generator
- Throws:
Exception
- if an error occurs while adding the data
-
add
Writes a long value.- Parameters:
key
- they keyvalue
- the value- Returns:
- the generator
- Throws:
Exception
- if an error occurs while adding the data
-
add
Writes a map value- Parameters:
key
- the key for the mapvalue
- the map- Returns:
- the generator
- Throws:
Exception
- if an error occurs while adding the data
-
add
Writes a string value.- Parameters:
key
- the key for the valuevalue
- the string value- Returns:
- the generator
- Throws:
Exception
- if an error occurs while adding the data
-
addMetaData
Adds the meta data to the structured format.By default this processes the map and uses
add(String, String)
to add entries.- Parameters:
metaData
- the matp of the meta data, cannot benull
- Returns:
- the generator
- Throws:
Exception
- if an error occurs while adding the data
-
startObject
Writes the start of an object.If the
wrapArrays()
returnsfalse
the key may benull
and implementations should handle this.- Parameters:
key
- they key for the object, ornull
if this object was started in an array and thewrapArrays()
isfalse
- Returns:
- the generator
- Throws:
Exception
- if an error occurs while adding the data
-
endObject
Writes an end to the object.- Returns:
- the generator
- Throws:
Exception
- if an error occurs while adding the data
-
startArray
Writes the start of an array. This defaults tostartObject(String)
for convenience of generators that don't have a specific type for arrays.- Parameters:
key
- they key for the array- Returns:
- the generator
- Throws:
Exception
- if an error occurs while adding the data
-
endArray
Writes an end for an array. This defaults toendObject()
for convenience of generators that don't have a specific type for arrays.- Returns:
- the generator
- Throws:
Exception
- if an error occurs while adding the data
-
addAttribute
Writes an attribute.By default this uses the
add(String, int)
method to add the attribute. If a formatter requires special handling for attributes, for example an attribute on an XML element, this method can be overridden.- Parameters:
name
- the name of the attributevalue
- the value of the attribute- Returns:
- the generator
- Throws:
Exception
- if an error occurs while adding the data
-
addAttribute
Writes an attribute.By default this uses the
add(String, String)
method to add the attribute. If a formatter requires special handling for attributes, for example an attribute on an XML element, this method can be overridden.- Parameters:
name
- the name of the attributevalue
- the value of the attribute- Returns:
- the generator
- Throws:
Exception
- if an error occurs while adding the data
-
end
Writes any trailing data that's needed.- Returns:
- the generator
- Throws:
Exception
- if an error occurs while adding the data during the build
-
wrapArrays
default boolean wrapArrays()Indicates whether or not elements in an array should be wrapped or not. The default isfalse
.- Returns:
true
if elements should be wrapped, otherwisefalse
-