Class ObjectBuilder


  • public final class ObjectBuilder
    extends java.lang.Object
    A builder created by LDValue.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.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • ObjectBuilder

        public ObjectBuilder()
    • 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 key
        value - 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 key
        value - 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 key
        value - 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 key
        value - 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 key
        value - 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 key
        value - 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 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