Package com.dnanexus

Class DXJSON.ObjectBuilder

  • Enclosing class:
    DXJSON

    public static class DXJSON.ObjectBuilder
    extends Object
    Builder class that generates a JSON object (hash). Example:
     
     ObjectNode o = DXJSON.getObjectBuilder()
                          .put("key1", "a-string")
                          .put("key2", 12321)
                          .build()
    when serialized, produces the JSON object {"key1": "a-string", "key2": 12321}.
    • Constructor Detail

      • ObjectBuilder

        public ObjectBuilder()
        Initializes an ObjectBuilder which will generate an empty object.
    • Method Detail

      • put

        public DXJSON.ObjectBuilder put​(String key,
                                        com.fasterxml.jackson.databind.JsonNode value)
        Adds a key-value pair with an arbitrary JsonNode value.
      • put

        public DXJSON.ObjectBuilder put​(String key,
                                        int value)
        Adds a key-value pair with a numeric value and returns the resulting ObjectBuilder.
      • put

        public DXJSON.ObjectBuilder put​(String key,
                                        long value)
        Adds a key-value pair with a numeric value and returns the resulting ObjectBuilder.
      • put

        public DXJSON.ObjectBuilder put​(String key,
                                        double value)
        Adds a key-value pair with a numeric value and returns the resulting ObjectBuilder.
      • put

        public DXJSON.ObjectBuilder put​(String key,
                                        boolean value)
        Adds a key-value pair with a boolean value and returns the resulting ObjectBuilder.
      • build

        public com.fasterxml.jackson.databind.node.ObjectNode build()
        Generates a JSON object.