protected static interface StructuredFormatter.Generator
Modifier and Type | Method and Description |
---|---|
default StructuredFormatter.Generator |
add(String key,
int value)
Writes an integer value.
|
default StructuredFormatter.Generator |
add(String key,
long value)
Writes a long value.
|
StructuredFormatter.Generator |
add(String key,
Map<String,?> value)
Writes a map value
|
StructuredFormatter.Generator |
add(String key,
String value)
Writes a string value.
|
default 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.
|
StructuredFormatter.Generator |
end()
Writes any trailing data that's needed.
|
default StructuredFormatter.Generator |
endArray()
Writes an end for an array.
|
StructuredFormatter.Generator |
endObject()
Writes an end to the object.
|
default StructuredFormatter.Generator |
startArray(String key)
Writes the start of an array.
|
StructuredFormatter.Generator |
startObject(String key)
Writes the start of an object.
|
default boolean |
wrapArrays()
Indicates whether or not elements in an array should be wrapped or not.
|
default StructuredFormatter.Generator begin() throws Exception
Exception
- if an error occurs while adding the datadefault StructuredFormatter.Generator add(String key, int value) throws Exception
key
- they keyvalue
- the valueException
- if an error occurs while adding the datadefault StructuredFormatter.Generator add(String key, long value) throws Exception
key
- they keyvalue
- the valueException
- if an error occurs while adding the dataStructuredFormatter.Generator add(String key, Map<String,?> value) throws Exception
key
- the key for the mapvalue
- the mapException
- if an error occurs while adding the dataStructuredFormatter.Generator add(String key, String value) throws Exception
key
- the key for the valuevalue
- the string valueException
- if an error occurs while adding the datadefault StructuredFormatter.Generator addMetaData(Map<String,String> metaData) throws Exception
By default this processes the map and uses add(String, String)
to add entries.
metaData
- the matp of the meta data, cannot be null
Exception
- if an error occurs while adding the dataStructuredFormatter.Generator startObject(String key) throws Exception
If the wrapArrays()
returns false
the key may be null
and implementations should
handle this.
key
- they key for the object, or null
if this object was
started in an array and the wrapArrays()
is
false
Exception
- if an error occurs while adding the dataStructuredFormatter.Generator endObject() throws Exception
Exception
- if an error occurs while adding the datadefault StructuredFormatter.Generator startArray(String key) throws Exception
startObject(String)
for convenience of generators
that don't have a specific type for arrays.key
- they key for the arrayException
- if an error occurs while adding the datadefault StructuredFormatter.Generator endArray() throws Exception
endObject()
for convenience of generators that don't
have a specific type for arrays.Exception
- if an error occurs while adding the datadefault StructuredFormatter.Generator addAttribute(String name, int value) throws Exception
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.
name
- the name of the attributevalue
- the value of the attributeException
- if an error occurs while adding the datadefault StructuredFormatter.Generator addAttribute(String name, String value) throws Exception
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.
name
- the name of the attributevalue
- the value of the attributeException
- if an error occurs while adding the dataStructuredFormatter.Generator end() throws Exception
Exception
- if an error occurs while adding the data during the builddefault boolean wrapArrays()
false
.true
if elements should be wrapped, otherwise false
Copyright © 2018 JBoss by Red Hat. All rights reserved.