public static class DXJSON.ObjectBuilder extends Object
ObjectNode o = DXJSON.getObjectBuilder()
.put("key1", "a-string")
.put("key2", 12321)
.build()
when serialized, produces the JSON object {"key1": "a-string", "key2": 12321}
.Constructor and Description |
---|
ObjectBuilder()
Initializes an ObjectBuilder which will generate an empty object.
|
Modifier and Type | Method and Description |
---|---|
com.fasterxml.jackson.databind.node.ObjectNode |
build()
Generates a JSON object.
|
DXJSON.ObjectBuilder |
put(String key,
boolean value)
Adds a key-value pair with a boolean value and returns the resulting
ObjectBuilder.
|
DXJSON.ObjectBuilder |
put(String key,
double value)
Adds a key-value pair with a numeric value and returns the resulting
ObjectBuilder.
|
DXJSON.ObjectBuilder |
put(String key,
int value)
Adds a key-value pair with a numeric value and returns the resulting
ObjectBuilder.
|
DXJSON.ObjectBuilder |
put(String key,
com.fasterxml.jackson.databind.JsonNode value)
Adds a key-value pair with an arbitrary JsonNode value.
|
DXJSON.ObjectBuilder |
put(String key,
long value)
Adds a key-value pair with a numeric value and returns the resulting
ObjectBuilder.
|
DXJSON.ObjectBuilder |
put(String key,
String value)
Adds a key-value pair with a string value and returns the resulting
ObjectBuilder.
|
public ObjectBuilder()
public DXJSON.ObjectBuilder put(String key, com.fasterxml.jackson.databind.JsonNode value)
public DXJSON.ObjectBuilder put(String key, String value)
public DXJSON.ObjectBuilder put(String key, int value)
public DXJSON.ObjectBuilder put(String key, long value)
public DXJSON.ObjectBuilder put(String key, double value)
public DXJSON.ObjectBuilder put(String key, boolean value)
public com.fasterxml.jackson.databind.node.ObjectNode build()
Copyright © 2023. All Rights Reserved.