Class MapBuilder
- java.lang.Object
-
- io.dropwizard.logging.json.layout.MapBuilder
-
public class MapBuilder extends Object
Builds a Java map based on the provided configuration and customization.
-
-
Constructor Summary
Constructors Constructor Description MapBuilder(TimestampFormatter timestampFormatter, Map<String,String> customFieldNames, Map<String,Object> additionalFields, int expectedSize)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description MapBuilder
add(String fieldName, boolean include, String value)
Adds the string value to the provided map under the provided field name, if it should be included.MapBuilder
add(String fieldName, boolean include, Supplier<String> supplier)
Adds the string value to the provided map under the provided field name, if it should be included.MapBuilder
add(String fieldName, boolean include, Map<String,?> mapValue)
Adds the map to the provided map under the provided field name if it's should be included.MapBuilder
addMap(String fieldName, boolean include, Supplier<Map<String,?>> supplier)
Adds the map value to the provided map under the provided field name, if it should be included.MapBuilder
addNumber(String fieldName, boolean include, Number number)
Adds the number to the provided map under the provided field name if it's should be included.MapBuilder
addNumber(String fieldName, boolean include, Supplier<Number> supplier)
Adds the number value to the provided map under the provided field name, if it should be included.MapBuilder
addTimestamp(String fieldName, boolean include, long timestamp)
Adds and optionally formats the timestamp to the provided map under the provided field name, if it's should be included.Map<String,Object>
build()
-
-
-
Method Detail
-
add
public MapBuilder add(String fieldName, boolean include, @Nullable String value)
Adds the string value to the provided map under the provided field name, if it should be included.
-
add
public MapBuilder add(String fieldName, boolean include, Supplier<String> supplier)
Adds the string value to the provided map under the provided field name, if it should be included. The supplier is only invoked if the field is to be included.- Since:
- 2.0
-
addNumber
public MapBuilder addNumber(String fieldName, boolean include, @Nullable Number number)
Adds the number to the provided map under the provided field name if it's should be included.
-
addNumber
public MapBuilder addNumber(String fieldName, boolean include, Supplier<Number> supplier)
Adds the number value to the provided map under the provided field name, if it should be included. The supplier is only invoked if the field is to be included.- Since:
- 2.0
-
add
public MapBuilder add(String fieldName, boolean include, @Nullable Map<String,?> mapValue)
Adds the map to the provided map under the provided field name if it's should be included.
-
addMap
public MapBuilder addMap(String fieldName, boolean include, Supplier<Map<String,?>> supplier)
Adds the map value to the provided map under the provided field name, if it should be included. The supplier is only invoked if the field is to be included.- Since:
- 2.0
-
addTimestamp
public MapBuilder addTimestamp(String fieldName, boolean include, long timestamp)
Adds and optionally formats the timestamp to the provided map under the provided field name, if it's should be included.
-
-