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 Details

  • Method Details

    • 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.
    • build

      public Map<String,Object> build()