Class ObjectBuilder

java.lang.Object
com.launchdarkly.sdk.ObjectBuilder

public final class ObjectBuilder extends Object
A builder created by LDValue.buildObject().

Builder methods are not thread-safe.

  • Constructor Details

    • ObjectBuilder

      public ObjectBuilder()
  • Method Details

    • put

      public ObjectBuilder put(String key, LDValue value)
      Sets a key-value pair in the builder, overwriting any previous value for that key.
      Parameters:
      key - a string key
      value - a value
      Returns:
      the same builder
    • put

      public ObjectBuilder put(String key, boolean value)
      Sets a key-value pair in the builder, overwriting any previous value for that key.
      Parameters:
      key - a string key
      value - a value
      Returns:
      the same builder
    • put

      public ObjectBuilder put(String key, int value)
      Sets a key-value pair in the builder, overwriting any previous value for that key.
      Parameters:
      key - a string key
      value - a value
      Returns:
      the same builder
    • put

      public ObjectBuilder put(String key, long value)
      Sets a key-value pair in the builder, overwriting any previous value for that key.
      Parameters:
      key - a string key
      value - a value
      Returns:
      the same builder
    • put

      public ObjectBuilder put(String key, float value)
      Sets a key-value pair in the builder, overwriting any previous value for that key.
      Parameters:
      key - a string key
      value - a value
      Returns:
      the same builder
    • put

      public ObjectBuilder put(String key, double value)
      Sets a key-value pair in the builder, overwriting any previous value for that key.
      Parameters:
      key - a string key
      value - a value
      Returns:
      the same builder
    • put

      public ObjectBuilder put(String key, String value)
      Sets a key-value pair in the builder, overwriting any previous value for that key.
      Parameters:
      key - a string key
      value - a value
      Returns:
      the same builder
    • build

      public LDValue build()
      Returns an object containing the builder's current elements. Subsequent changes to the builder will not affect this value (it uses copy-on-write logic, so the previous values will only be copied to a new map if you continue to add elements after calling build().
      Returns:
      an LDValue that is a JSON object