Package com.launchdarkly.sdk
Class ObjectBuilder
- java.lang.Object
-
- com.launchdarkly.sdk.ObjectBuilder
-
public final class ObjectBuilder extends java.lang.Object
A builder created byLDValue.buildObject()
.Builder methods are not thread-safe.
-
-
Constructor Summary
Constructors Constructor Description ObjectBuilder()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description LDValue
build()
Returns an object containing the builder's current elements.ObjectBuilder
put(java.lang.String key, boolean value)
Sets a key-value pair in the builder, overwriting any previous value for that key.ObjectBuilder
put(java.lang.String key, double value)
Sets a key-value pair in the builder, overwriting any previous value for that key.ObjectBuilder
put(java.lang.String key, float value)
Sets a key-value pair in the builder, overwriting any previous value for that key.ObjectBuilder
put(java.lang.String key, int value)
Sets a key-value pair in the builder, overwriting any previous value for that key.ObjectBuilder
put(java.lang.String key, long value)
Sets a key-value pair in the builder, overwriting any previous value for that key.ObjectBuilder
put(java.lang.String key, LDValue value)
Sets a key-value pair in the builder, overwriting any previous value for that key.ObjectBuilder
put(java.lang.String key, java.lang.String value)
Sets a key-value pair in the builder, overwriting any previous value for that key.
-
-
-
Method Detail
-
put
public ObjectBuilder put(java.lang.String key, LDValue value)
Sets a key-value pair in the builder, overwriting any previous value for that key.- Parameters:
key
- a string keyvalue
- a value- Returns:
- the same builder
-
put
public ObjectBuilder put(java.lang.String key, boolean value)
Sets a key-value pair in the builder, overwriting any previous value for that key.- Parameters:
key
- a string keyvalue
- a value- Returns:
- the same builder
-
put
public ObjectBuilder put(java.lang.String key, int value)
Sets a key-value pair in the builder, overwriting any previous value for that key.- Parameters:
key
- a string keyvalue
- a value- Returns:
- the same builder
-
put
public ObjectBuilder put(java.lang.String key, long value)
Sets a key-value pair in the builder, overwriting any previous value for that key.- Parameters:
key
- a string keyvalue
- a value- Returns:
- the same builder
-
put
public ObjectBuilder put(java.lang.String key, float value)
Sets a key-value pair in the builder, overwriting any previous value for that key.- Parameters:
key
- a string keyvalue
- a value- Returns:
- the same builder
-
put
public ObjectBuilder put(java.lang.String key, double value)
Sets a key-value pair in the builder, overwriting any previous value for that key.- Parameters:
key
- a string keyvalue
- a value- Returns:
- the same builder
-
put
public ObjectBuilder put(java.lang.String key, java.lang.String value)
Sets a key-value pair in the builder, overwriting any previous value for that key.- Parameters:
key
- a string keyvalue
- 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 callingbuild()
.- Returns:
- an
LDValue
that is a JSON object
-
-